Digestive Enzymes 60ct + 60B Probiotic 30ct | Value Digestive Bundle by Physician's Choice
${function() {
const variantData = data.variant || {"id":"85081920-5739-48af-9d3f-8a7d21d87c5a","product_id":"8e3713b3-76d2-42fc-8ead-75dc36ea16e7","title":"1 Bundle","weight_unit":"kg","inventory_quantity":1000,"sku":"080918-DIG-1ComboPack","barcode":"","position":1,"option1":"1 Bundle","option2":"","option3":"","note":"","image":null,"wholesale_price":[{"price":32.97,"min_quantity":1}],"weight":"0","compare_at_price":"0","price":"32.97","retail_price":"0","available":true,"url":"\/products\/digestive-enzymes-60ct-60b-probiotic-30ct-value-digestive-bundle-by-physicians-choice-17268064?variant=85081920-5739-48af-9d3f-8a7d21d87c5a","available_quantity":999999999,"options":[{"name":"BUY MORE SAVE MORE","value":"1 Bundle"}],"off_ratio":0,"flashsale_info":[],"sales":0};
const saveType = "percentage";
const productLabelDiscountOn = true;
return `
-
${saveType == 'percentage'
? `-${variantData.off_ratio}% `
: `- `
}
`;
}()}
Buy More Save More:
1 Bundle
${function(){
const optName = "BUY MORE SAVE MORE";
const optionValue = data.originData.selectData ? data.originData.selectData[optName].value : data.originData.value;
const optionValueText = optionValue ? (optionValue) : '';
return `${optionValueText} `;
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
Add to cart
$32.97
${function(){
const wholesale_enabled = false;
const qty = data.quantity || 1;
const currentSelectVariant = data.variant;
const defaultVariant = (data.product && data.product.variants && data.product.variants[0]);
const productVariant = {"id":"85081920-5739-48af-9d3f-8a7d21d87c5a","product_id":"8e3713b3-76d2-42fc-8ead-75dc36ea16e7","title":"1 Bundle","weight_unit":"kg","inventory_quantity":1000,"sku":"080918-DIG-1ComboPack","barcode":"","position":1,"option1":"1 Bundle","option2":"","option3":"","note":"","image":null,"wholesale_price":[{"price":32.97,"min_quantity":1}],"weight":"0","compare_at_price":"0","price":"32.97","retail_price":"0","available":true,"url":"\/products\/digestive-enzymes-60ct-60b-probiotic-30ct-value-digestive-bundle-by-physicians-choice-17268064?variant=85081920-5739-48af-9d3f-8a7d21d87c5a","available_quantity":999999999,"options":[{"name":"BUY MORE SAVE MORE","value":"1 Bundle"}],"off_ratio":0,"flashsale_info":[],"sales":0};
const variantData = currentSelectVariant || defaultVariant || productVariant;
const wholesale_price = variantData.wholesale_price || [];
if(wholesale_enabled && wholesale_price.length > 0) {
let wholesaleIndex = wholesale_price.findIndex(item => {
return item.min_quantity > qty;
});
if(wholesaleIndex < 0){
wholesaleIndex = wholesale_price.length - 1;
}else if(wholesaleIndex > 0){
wholesaleIndex = wholesaleIndex - 1;
}
const wholesalePrice = wholesale_price[wholesaleIndex] || '';
return `
`
}else {
const price = variantData && variantData.price;
return price != undefined ? `
` : ' ';
}
}()}
Buy now
Product was out of stock.
Product is unavailable.
About this item Optimal Gut Health: Our bundle combines the power of our 60 billion CFU probiotic with Digestive Enzymes to promote a balanced and healthy gut environment. Say goodbye to digestive discomfort. Enhanced Nutrient Absorption: Our digestive enzymes assist in breaking down food more effectively. helping your body absorb essential nutrients from your diet. Survives the Gut: From start to finish - this probiotic is designed to survive the gut & maximize the colonization of our strains. Digestive Comfort: Bid farewell to bloating. gas. and indigestion. The combination of probiotics and digestive enzymes in this bundle supports smoother digestion. reducing discomfort after meals and supporting a flatter stomach. Convenience and Savings: By bundling our best-selling probiotics and digestive enzymes together. we offer you the convenience of a comprehensive gut health solution in one package. Plus. you'll save money compared to purchasing these products separately. making it a cost-effective choice for your health and wellness regimen. This bundle contains 2 items (may ship separately)
1 of Digestive Enzymes 60ct
Max Strength General Purpose Probiotic: Our non-refrigerated probiotic is designed to support digestive health & gut health. A great choice for those looking to support a diverse healthy microbiome w/ 60B CFU - Probiotics for Women & Men alike Support Your Gut: Our probiotic contains 10 diverse high-quality probiotic strains and organic prebiotics - synergistically working together to support your gut health. Expertly crafted to support occasional constipation. diarrhea. gas & bloating! Survives the Gut: From start to finish - this probiotic is designed to survive the gut & maximize the colonization of our strains. We use a shelf-stable bottle. acid-resistant capsules. and 60 Billion Colony forming units (CFU) to achieve this! Backed By Science - Our probiotics are crafted based on scientific research. We have partnered with a network of expert physicians to help review our products & research. We strive to educate & help you with informed decisions regarding your health. Safety Assured Standard of Quality: Our 60B probiotic is 3rd-party tested for purity and potency. Each bottle is manufactured with love & care in the USA with strict quality control - using imported and domestic ingredients.
1 of 60B Probiotic 30ct
Beat the Bloat & Say Goodbye to Meal Time Discomfort: 16 beneficial enzymes that digest proteins. carbs. fruits. veggies. beans. dairy. & fats to cover all diets. With SBO Probiotics & Prebiotics to aid digestion further - Your New Meal Time Hack! Dual Action Relief: Our powerful digestive enzymes aid with breaking down food while the prebiotics & probiotics promote digestive function in the gut. They work synergistically to provide relief from mealtime discomfort. Probiotics that Survive the Gut: Formulated with 3 soil-based probiotic strains - specifically selected due to their ability to survive the harsh gut environment. Along with Organic Prebiotics that fuel the growth of healthy bacteria in the gut. Science Backed - Our Digestive Enzyme Probiotics are crafted based on scientific research. We have partnered with expert physicians to help review our products & research. We strive to educate & help you with informed decisions regarding your health. Safety Assured Standard of Quality: Our Digestive Enzymes are 3rd-party tested for purity and potency. Each bottle is manufactured with love & care in the USA with strict quality control - using imported and domestic ingredients. 365-day money-back guarantee We offer a 365-day money-back guarantee. allowing you to try our product with complete peace of mind. If. for any reason. you are not satisfied with your purchase within 365 days. simply contact us and we'll issue a full refund. no questions asked.
WHY US?
We work directly with manufacturers all over the world to ensure the best quality of our products. We have Quality Control department which help us to keep our promise! Price is always competitive. Awesome Customer Service Amazing products along with High Quality Read reviews from our lovely customers CLICK ADD TO CART TO ENJOY THE COMFY! *Limited Items Available In Stock! Not Sold In Stores*
The Checkout Process is Guaranteed to be 100% Safe and Secure with Visa. Mastercard. AMex. Discover. Apple Pay or PayPal.
100% Satisfaction Guaranteed With Every Order
MONEY BACK GUARANTEE We want you to be 100% satisfied with the products you buy from us. If for ANY reason you are not satisfied with your purchase. we offer iron-clad money back guarantee.
⭐I Wish You A Happy Shopping. THANK YOU⭐
Click the 'Add to Cart' and 'Buy Now' button to GET YOURS!
/** @private {string} */
class SpzCustomAnchorScroll extends SPZ.BaseElement {
static deferredMount() {
return false;
}
constructor(element) {
super(element);
/** @private {Element} */
this.scrollableContainer_ = null;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.LOGIC;
}
buildCallback() {
this.viewport_ = this.getViewport();
this.initActions_();
}
setTarget(containerId, targetId) {
this.containerId = '#' + containerId;
this.targetId = '#' + targetId;
}
scrollToTarget() {
const container = document.querySelector(this.containerId);
const target = container.querySelector(this.targetId);
const {scrollTop} = container;
const eleOffsetTop = this.getOffsetTop_(target, container);
this.viewport_
.interpolateScrollIntoView_(
container,
scrollTop,
scrollTop + eleOffsetTop
);
}
initActions_() {
this.registerAction(
'scrollToTarget',
(invocation) => this.scrollToTarget(invocation?.caller)
);
this.registerAction(
'setTarget',
(invocation) => this.setTarget(invocation?.args?.containerId, invocation?.args?.targetId)
);
}
/**
* @param {Element} element
* @param {Element} container
* @return {number}
* @private
*/
getOffsetTop_(element, container) {
if (!element./*OK*/ getClientRects().length) {
return 0;
}
const rect = element./*OK*/ getBoundingClientRect();
if (rect.width || rect.height) {
return rect.top - container./*OK*/ getBoundingClientRect().top;
}
return rect.top;
}
}
SPZ.defineElement('spz-custom-anchor-scroll', SpzCustomAnchorScroll);
const STRENGTHEN_TRUST_URL = "/api/strengthen_trust/settings";
class SpzCustomStrengthenTrust extends SPZ.BaseElement {
constructor(element) {
super(element);
this.renderElement_ = null;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.CONTAINER;
}
buildCallback() {
this.xhr_ = SPZServices.xhrFor(this.win);
const renderId = this.element.getAttribute('render-id');
SPZCore.Dom.waitForChild(
document.body,
() => !!document.getElementById(renderId),
() => {
this.renderElement_ = SPZCore.Dom.scopedQuerySelector(
document.body,
`#${renderId}`
);
if (this.renderElement_) {
this.render_();
}
this.registerAction('track', (invocation) => {
this.track_(invocation.args);
});
}
);
}
render_() {
this.fetchData_().then((data) => {
if (!data) {
return;
}
SPZ.whenApiDefined(this.renderElement_).then((apis) => {
apis?.render(data);
document.querySelector('#strengthen-trust-render-1539149753700').addEventListener('click',(event)=>{
if(event.target.nodeName == 'A'){
this.track_({type: 'trust_content_click'});
}
})
});
});
}
track_(data = {}) {
const track = window.sa && window.sa.track;
if (!track) {
return;
}
track('trust_enhancement_event', data);
}
parseJSON_(string) {
let result = {};
try {
result = JSON.parse(string);
} catch (e) {}
return result;
}
fetchData_() {
return this.xhr_
.fetchJson(STRENGTHEN_TRUST_URL)
.then((responseData) => {
if (!responseData || !responseData.data) {
return null;
}
const data = responseData.data;
const moduleSettings = (data.module_settings || []).reduce((result, moduleSetting) => {
return result.concat(Object.assign(moduleSetting, {
logos: (moduleSetting.logos || []).map((item) => {
return moduleSetting.logos_type == 'custom' ? this.parseJSON_(item) : item;
})
}));
}, []);
return Object.assign(data, {
module_settings: moduleSettings,
isEditor: window.self !== window.top,
});
});
}
}
SPZ.defineElement('spz-custom-strengthen-trust', SpzCustomStrengthenTrust);
${data.module_title}
To display this card to customers, you need to go to "Booster & Store Conversion" to turn on the trust enhancement feature.
${item.content.replaceAll("{store_name}","The Green Nutrition")}
To display this card to customers, you need to go to "Booster & Store Conversion" to turn on the trust enhancement feature.
${function() {
const postageFreeAmount = 59;
const custom_text = "Buy {amount} more to enjoy FREE Shipping";
const totalPrice = +data.total_price;
const diffPrice = postageFreeAmount - totalPrice;
const percentDiff = (diffPrice > 0 ? (totalPrice / postageFreeAmount * 100) : 100) + '%';
let tipText = "Your order is free delivery";
if (diffPrice > 0) {
tipText = custom_text.replace('{amount}', `
`);
}
return `
`;
}()}
people are viewing this right now
const addToCartText = "Add to cart";
SPZCore.Dom.waitForChild(
document.body,
() => !!document.querySelector('[data-click="addToCart"], [role="addToCart"]'),
() => {
const addToCartEle = window.SPZCore.Dom.scopedQuerySelector(
document.body,
'[data-click="addToCart"], [role="addToCart"]'
);
const getContentChild_ = function(el) {
if(el) {
const childs = el.childNodes;
for (let i = childs.length - 1; i >= 0; i--) {
const child = childs[i];
if (child.getAttribute && child.getAttribute('role') === 'content') {
return child;
}
}
}
return;
}
const changeAddToCartText = function(text) {
const contentEle = getContentChild_(addToCartEle);
if(contentEle){
const addToCartChilds = addToCartEle.childNodes;
for (let i = addToCartChilds.length - 1; i >= 0; i--) {
const child = addToCartChilds[i];
if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) {
addToCartEle.removeChild(child);
}
}
}else{
addToCartEle.innerHTML = addToCartText;
}
}
changeAddToCartText(addToCartText);
}
);
const SITE = (window.C_SETTINGS && window.C_SETTINGS.routes && window.C_SETTINGS.routes.root) || '';
const PRODUCT_PLAN_INFO_URL =
`${SITE}/api/storefront/selling_plans/product_plan_info/:product_id`;
const { i18nProductDetail, i18nProduct } = JSON.parse(
document.querySelector('#i18n-json').textContent
);
const currentI18nProduct = i18nProductDetail || i18nProduct;
class SpzCustomSubscription extends SPZ.BaseElement {
constructor(element) {
super(element);
this.productPlanInfo = null;
this.cycle = null;
this.optionid_ = null;
this.form_ = null;
this.variantId_ = null;
this.variantChangeData = null;
this.cycleList = [1,2];
this.productId = this.element.getAttribute('productId');
this.initialCycle = this.element.getAttribute('cycles');
this.noPlanShowTitle = JSON.parse(this.element.getAttribute('noPlanShowTitle'));
}
get initIsCycleSubscribe() {
if(this.initialCycle == 2) {
return true;
}
if(this.initialCycle == 1) {
return false;
}
return null;
}
get productInfo() {
let pJson = document.querySelector('#product-json');
if (pJson) {
return JSON.parse(pJson.innerHTML);
}else if(typeof $ === 'function' && typeof $(document).data === 'function') {
return $(document).data('djproduct');
}
return null;
}
get hasSKU() {
if(this.productPlanInfo?.sku) {
return true;
}
return false
}
get hasSPU() {
if(this.productPlanInfo?.spu) {
return true;
}
return false
}
get originalPrice() {
if(!this.variantChangeData?.selected?.price){
return '';
};
return this.variantChangeData.selected.price;
}
get defaultPlanData() {
if (!this.productPlanInfo) {
return {};
}
let planInfo = {};
if(this.hasSPU && this.productPlanInfo?.spu[this.productId]) {
planInfo = this.productPlanInfo.spu[this.productId];
}else if(this.hasSKU && this.productPlanInfo?.sku[this.variantId_]) {
planInfo = this.productPlanInfo.sku[this.variantId_];
}
return planInfo;
}
get defaultCycle_() {
if(!this.defaultPlanData) {
return null;
}
return this.defaultPlanData.cycles;
}
get defaultOption_() {
if(!this.defaultPlanData) {
return null;
}
return this.defaultPlanData.selected_selling_plan_option_id;
}
get isCycleSubscribe() {
if(this.cycle === 2) {
return true;
}
if(this.cycle === 1) {
return false;
}
return null;
}
get currentOption_() {
if(!this.isCycleSubscribe){
return null;
}
if(!this.optionId_) {
return this.defaultOption_;
}
return this.optionId_;
}
get currentPlanData() {
if(!this.defaultPlanData) {
return {};
}
let result = Object.assign({},this.defaultPlanData);
if(result.selected_selling_plan_option_id !== this.optionId_) {
result.selected_selling_plan_option_id = this.optionId_;
result.selling_plan_options = result.selling_plan_options.map(item => {
return {
...item,
selected_enabled: item.selling_plan_option_id === result.selected_selling_plan_option_id
}
})
}
if (result.cycles !== this.cycle) {
result.cycles = this.cycle;
}
return result;
}
fetchData_(product_id) {
return SPZServices.xhrFor(this.win).fetchJson(PRODUCT_PLAN_INFO_URL.replace(/:product_id/gi, product_id))
.then((data) => {
this.productPlanInfo = data;
}
);
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.CONTAINER;
}
mountCallback() {
this.getElement_();
Promise.all([this.productInfoReady_(), this.fetchData_(this.productId)]).then(() => {
this.initVariantId();
this.init_();
this.initActions_();
if(!!this.variantId_) {
this.track_('product_view', this.initIsCycleSubscribe);
}
this.showPlan_(true);
if(!!this.variantId_){
this.changeBuyNowText();
this.dispatchSubScribeIdChange_();
}
});
}
productInfoReady_() {
if(this.productInfo) {
return Promise.resolve();
}
SPZUtils.Event.listen(document,'load',()=> {
if(this.productInfo) {
return Promise.resolve();
}else{
return Promise.reject();
}
})
}
getElement_() {
this.titleEle = SPZCore.Dom.scopedQuerySelector(document.body, '[role="plugin-subscription-title"]');
this.noPlanTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-plan-tips"]');
this.noPaymentTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-payment-tips"]');
this.renderEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-content-render"]');
this.productEle = SPZCore.Dom.scopedQuerySelector(document.body, '[data-section-type="product"], [data-section-type="product_detail"], [data-section-type="product_club"]')
this.buyNowEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="submit"], [role="buyNow"]');
this.addToCartEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="addToCart"], [role="addToCart"]');
}
init_() {
this.cycle = this.defaultCycle_;
this.optionId_ = this.defaultOption_;
this.variantChangeData = this.productInfo;
}
initVariantId() {
const formData = this.getFormData();
if (formData) {
if(formData['variant_id'] && formData['variant_id'] !== 'undefined') {
this.variantId_ = formData['variant_id'];
}else{
this.variantId_ = ''
}
}else if(this.productInfo?.selected?.id){
this.variantId_ = this.productInfo.selected.id
}else{
this.variantId_ = ''
}
}
getFormData() {
this.form_ = this.element.closest('form');
if(!this.form_) {
return null;
}
const result = {
quantity: 1,
};
const formData = new FormData(this.form_);
const formDataKey = formData.keys();
for (const key of formDataKey) {
result[key] = formData.get(key);
}
return result;
}
showPlan_(rerender = false) {
if (!this.variantId_) {
return this.hide_();
}
if (rerender) {
this.renderPlan_();
}
}
renderPlan_() {
if (Object.keys(this.currentPlanData).length === 0) {
this.showNoPlanTips_(true);
this.showNoPaymentTips_(false);
this.showRender_(false);
if(this.noPlanShowTitle) {
this.showTitle_(true);
}else{
this.showTitle_(false);
}
return;
}
this.showRender_(true);
this.showNoPaymentTips_(true);
this.showTitle_(true);
this.showNoPlanTips_(false);
const selectedPlanItem = this.currentPlanData.selling_plan_options.filter((item) => item.selected_enabled === true)[0];
SPZ.whenApiDefined(this.renderEle).then((apis) => {
apis.render({ ...this.currentPlanData, originalPrice: this.originalPrice, selectedPlanItem }, false);
});
}
showTitle_(visible = true) {
if(this.titleEle) {
this.titleEle.toggleAttribute('hide', !visible);
}
}
showNoPlanTips_(visible = true) {
if(this.noPlanTipsEle) {
this.noPlanTipsEle.toggleAttribute('hide', !visible);
}
}
showNoPaymentTips_(visible = true) {
if(this.noPaymentTipsEle){
this.noPaymentTipsEle.toggleAttribute('hide', !visible);
}
}
showRender_(visible = true) {
if(this.renderEle){
this.renderEle.toggleAttribute('hide', !visible);
}
}
hide_() {
this.showTitle_(false);
this.element.toggleAttribute('hide', true);
}
show_() {
this.showTitle_(true);
this.element.toggleAttribute('hide', false);
}
dispatchSubScribeIdChange_() {
this.dispatchEvent_('payment_ec_refresh', {
sources: 'subscription'
});
}
dispatchEvent_(name, data) {
const event = SPZUtils.Event.create(this.win, name, data, { bubbles: true });
this.element.dispatchEvent(event);
}
initActions_() {
this.onVariantChange_();
this.element.addEventListener('change', (e) => {
if(e.target?.role === 'plugin-subscription-option-selector') {
this.onOptionChange_(e.target.value);
}
if(e.target?.role === 'plugin-subscription-option-card') {
this.changeCardOption_(e.target.value);
}
});
this.registerAction(
'changeCycle',
(invocation) => this.onCycleChange_(invocation.args?.selectedOptions[0])
);
this.registerAction('subscribeChange', (invocation) => {
this.dispatchSubScribeIdChange_(invocation.args);
});
this.addToCartEle.addEventListener('click', () => {
this.track_('add_to_cart');
});
this.buyNowEle.addEventListener('click', () => {
this.track_('add_to_cart');
});
this.submitInterrapt();
}
onVariantChange_() {
SPZUtils.Event.listen(document, 'dj.variantChange', (e) => {
if(this.variantId_ === e.detail?.selected?.id) {
return;
}
if(!this.variantId_ && e.detail?.selected?.id) {
this.show_();
}
this.variantId_ = e.detail.selected?.id;
this.optionId_ = this.defaultOption_;
this.cycle = this.defaultCycle_;
this.variantChangeData = Object.assign(this.variantChangeData, e.detail);
this.changeBuyNowText();
this.changeAddToCartText(e.detail);
this.showPlan_(true);
this.track_('product_view');
});
}
onOptionChange_(op, render = true) {
this.optionId_ = op;
this.changeBuyNowText();
if(render) {
this.showPlan_(true);
}
}
onCycleChange_(val, render = true) {
const cy = Number(val);
if (this.cycleList.includes(cy)) {
this.cycle = cy;
this.changeBuyNowText();
if(render) {
this.showPlan_(true);
}
}
}
submitInterrapt() {
if(!this.form_) {
window.djInterceptors.request.use((config) => {
if(config?.url === '/api/cart') {
return this.addToCartRequestData_(config);
}
if(config?.url === '/api/checkout/order') {
return this.checkoutOrderRequestData_(config);
}
})
}
}
addToCartRequestData_(config) {
const cartConfig = { ...config };
const hasProductId = cartConfig?.body?.product_id;
const hasVariantId = cartConfig?.body?.variant_id;
if(cartConfig?.method == 'POST' && hasProductId && hasVariantId) {
if (!cartConfig.body.properties) {
cartConfig.body.properties = {};
}
if(this.currentOption_) {
cartConfig.body.properties = {
...cartConfig.body.properties,
_selling_plan_option_id: this.currentOption_
}
}
}
return cartConfig;
}
checkoutOrderRequestData_(config) {
const orderConfig = { ...config };
const hasVariantId = orderConfig?.body?.line_items[0]?.variant_id;
if(orderConfig?.method == 'POST' && hasVariantId) {
if (!orderConfig.body.line_items[0].properties) {
orderConfig.body.line_items[0].properties = {};
}
if(this.currentOption_) {
orderConfig.body.line_items[0].properties = {
...orderConfig.body.line_items[0].properties,
_selling_plan_option_id: this.currentOption_
}
}
}
return orderConfig;
}
changeCardOption_(val) {
const oneTimeInputEle = document.querySelector('.one-time [role=plugin-subscription-option-card]');
if(val == 0) {
this.onCycleChange_(1, true);
oneTimeInputEle.toggleAttribute('disabled',true);
return;
}
oneTimeInputEle.toggleAttribute('disabled',false);
this.onCycleChange_(2, false);
this.onOptionChange_(val, true);
}
getContentChild_(el) {
if(el) {
const childs = el.childNodes;
for (let i = childs.length - 1; i >= 0; i--) {
const child = childs[i];
if (child.getAttribute && child.getAttribute('role') === 'content') {
return child;
}
}
}
return;
}
changeBuyNowText() {
let buyNowText = currentI18nProduct.buy_now;
let subscribeText = "Subscribe";
const contentEle = this.getContentChild_(this.buyNowEle);
// 1. 有role="content"的元素,替换role="content"的元素
if(contentEle) {
contentEle.innerHTML = this.isCycleSubscribe ? subscribeText : buyNowText;
}else{
// 2. 不存在role="content"的元素,直接替换文本
this.buyNowEle.innerHTML = this.isCycleSubscribe
? this.buyNowEle.innerHTML.replace(buyNowText, subscribeText) :
this.buyNowEle.innerHTML.replace(subscribeText, buyNowText);
}
}
changeAddToCartText(data) {
const contentEle = this.getContentChild_(this.addToCartEle);
// 1. 有role="content"的元素,移除role不等于content和loading的元素
if(contentEle) {
const addToCartChilds = this.addToCartEle.childNodes;
for (let i = addToCartChilds.length - 1; i >= 0; i--) {
const child = addToCartChilds[i];
// 移除元素(role不等于content和loading)
if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) {
this.addToCartEle.removeChild(child);
}
}
}else{
// 2. 不存在role="content"的元素,直接替换文本
const addToCartText = this.getAddToCartText_(data);
this.addToCartEle.innerHTML = addToCartText;
}
}
getAddToCartText_(data) {
const selected = data?.selected;
const productAvailable = data?.product?.available;
const variantAvailable = data?.selected?.available;
const variantId = data?.selected?.id;
let text = currentI18nProduct.add_to_cart;
if (!productAvailable) {
text = currentI18nProduct.sold_out;
}
if (selected && !variantId) {
text = currentI18nProduct.unavailable;
}
if (productAvailable && selected && variantId && !variantAvailable) {
text = currentI18nProduct.sold_out;
}
return text;
}
track_(eventName, optionSelected = this.isCycleSubscribe) {
if(window && window.sa && typeof window.sa.registerExtraInfo === 'function') {
window.sa.registerExtraInfo(eventName, {
function_name: "product_subscription",
module: "apps",
option_selected: optionSelected
}, optionSelected === null);
}
}
}
SPZ.defineElement('spz-custom-subscription', SpzCustomSubscription);
Purchase options:
Delivery frequency
Skip ,modify or cancel any time
${function() {
const blockStyle = 1;
const subscriptionLang = {"my_subscription":"My subscriptions","agree_to_subscription_terms":"By checking this box, you confirm that one or more items in your cart is a deferred or recurring purchase. Your subscription will automatically renew and your payment method will automatically be charged at the frequency listed on this page until you cancel it. You can change and cancel your subscription by clicking My Subscription. You accept and agree to the Subscription Policy.","agree_to_subscription_terms_error_message":"Please agree to the subscription terms to proceed with checkout","subscription_billing":"Subscription renewal charge","subscription_billing_tips":"After subscribing, you'll be billed automatically at regular intervals. You can check billing details or cancel anytime in your account's subscription management page after placing the order.","every_x_years":"Every {{ x }} year(s)","every_x_months":"Every {{ x }} month(s)","every_x_weeks":"Every {{ x }} week(s)","every_x_days":"Every {{ x }} day(s)","purchase_options":"Purchase options","subscribe":"Subscribe","save":"Save","delivery_frequency":"Delivery frequency","modify_tips":"Skip ,modify or cancel any time","one_time":"One-Time Purchase"};
const planTextLang = {
day: subscriptionLang.every_x_days,
week: subscriptionLang.every_x_weeks,
month: subscriptionLang.every_x_months,
year: subscriptionLang.every_x_years,
};
const regex = /\{\{\s*x\s*\}\}/;
return `
${function() {
const selected = data.cycles === 1 ? 'selected' : '';
return `
`
}()}
${function() {
const selected = data.cycles === 2 ? 'selected' : '';
return `
Subscribe
& Save
${ data.selectedPlanItem.discount_value }%
Delivery frequency
${function() {
const disabled = data.cycles === 1 ? 'disabled' : '';
return `
${data.selling_plan_options.map(item => {
const interval = item.interval;
const count = item.interval_count;
const planText = planTextLang[interval].replace(regex,count);
const selected = item.selected_enabled ? 'selected' : '';
return item.selected_enabled ? `
${planText}
`: `
${planText}
`
}).join('')}
`
}()}
${function() {
const checked = item.selected_enabled && data.cycles === 2 ? 'checked' : '';
const disabled = data.cycles === 1 ? 'disabled' : '';
return `
${function() {
const interval = item.interval;
const count = item.interval_count;
const planText = planTextLang[interval].replace(regex,count);
return `
${planText}
`
}()}
`
}()}
Skip ,modify or cancel any time
`
}()}
${function() {
const checked = data.cycles == 1 ? 'checked' : '';
const disabled = data.cycles == 1 ? 'disabled' : '';
return `
`
}()}
${function(){
const disabled = data.cycles === 1 ? 'disabled' : '';
return `
Subscribe
& Save
${
data.selling_plan_options.map(item => {
const checked = item.selected_enabled && data.cycles === 2 ? 'checked' : '';
const interval = item.interval;
const count = item.interval_count;
const planText = planTextLang[interval].replace(regex,count);
return `
${planText}
Save
Save ${ item.discount_value }%
`
}).join('')}
Skip ,modify or cancel any time
`
}()}
`;
}()}