@ordergroove/offers 2.36.0 → 2.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordergroove/offers",
3
- "version": "2.36.0",
3
+ "version": "2.36.1",
4
4
  "description": "offer state component",
5
5
  "author": "Eugenio Lattanzio <eugenio63@gmail.com>",
6
6
  "homepage": "https://github.com/ordergroove/plush-toys#readme",
@@ -48,5 +48,5 @@
48
48
  "@ordergroove/offers-templates": "^0.9.6",
49
49
  "@types/lodash.memoize": "^4.1.9"
50
50
  },
51
- "gitHead": "3d4c898b8dffb8c106a36e1f3eaa9c7291e70702"
51
+ "gitHead": "174743085e4d3672ceb73b8384b5cb897bc41289"
52
52
  }
@@ -319,23 +319,23 @@ export class Offer extends TemplateElement {
319
319
  return this.preview || window.og.previewMode;
320
320
  }
321
321
 
322
- get shouldRenderOffer() {
322
+ get shouldEnableOffer() {
323
323
  // currently, only the shopify reducer populates storeCurrency
324
324
  if (this.config && this.config.storeCurrency && this.config.merchantSettings) {
325
- const shouldRender =
325
+ const shouldEnable =
326
326
  this.config.merchantSettings.multicurrency_enabled ||
327
327
  this.config.storeCurrency === this.config.merchantSettings.currency_code;
328
- if (!shouldRender) {
328
+ if (!shouldEnable) {
329
329
  logMulticurrencyWarning(this.config.storeCurrency, this.config.merchantSettings.currency_code);
330
330
  }
331
- return shouldRender;
331
+ return shouldEnable;
332
332
  }
333
333
 
334
334
  return true;
335
335
  }
336
336
 
337
337
  render() {
338
- return this.shouldRenderOffer
338
+ return this.shouldEnableOffer
339
339
  ? html`
340
340
  <slot></slot>
341
341
  `
@@ -346,6 +346,7 @@ export function getSubscribedFrequency(productId, store) {
346
346
  */
347
347
  function synchronizeSellingPlan(store: any, offerElement?: HTMLElement) {
348
348
  if (offerElement.isCart) return; // hidden inputs are used when product page, not cart.
349
+ if (!offerElement.shouldEnableOffer) return; // do not set a selling plan if we're hiding the offer
349
350
 
350
351
  [...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach((productIdInput: HTMLInputElement) => {
351
352
  const productId = productIdInput.value;