测试属性款式,多款式含有sku属性——测试改title后,库存是否对应
${function() {
const variantData = data.variant || {"id":"6e0c50a1-b22c-4a4b-823a-23bb5b01711e","product_id":"c47bd11b-6c80-4fc1-85f8-a4711bd08770","title":"Red-L-font","weight_unit":"kg","inventory_quantity":999,"sku":"3656-Red-L-font-A0012767","barcode":"","position":15,"option1":"Red","option2":"L","option3":"font","note":"","image":{"src":"\/\/img.staticdj.com\/watermarkf219abd90b1445069bc01342d6126270.jpeg","path":"watermarkf219abd90b1445069bc01342d6126270.jpeg","width":5472,"height":3648,"alt":"\u6d4b\u8bd5\u5c5e\u6027\u6b3e\u5f0f,\u591a\u6b3e\u5f0f\u542b\u6709sku\u5c5e\u6027\u2014\u2014\u6d4b\u8bd5\u6539title\u540e\uff0c\u5e93\u5b58\u662f\u5426\u5bf9\u5e94","aspect_ratio":1.5},"wholesale_price":[{"price":50,"min_quantity":1}],"weight":"3","compare_at_price":"500","price":"50","retail_price":"500","available":true,"url":"\/products\/\u6d4b\u8bd5\u5c5e\u6027\u6b3e\u5f0f-\u591a\u6b3e\u5f0f\u542b\u6709sku\u5c5e\u6027?variant=6e0c50a1-b22c-4a4b-823a-23bb5b01711e","available_quantity":999,"options":[{"name":"color","value":"Red"},{"name":"EuSize","value":"L"},{"name":"position","value":"font"}],"off_ratio":90,"flashsale_info":[],"sales":21};
const saveType = "percentage";
const productLabelDiscountOn = true;
return `
-
${saveType == 'percentage'
? `-${variantData.off_ratio}%`
: `-`
}
`;
}()}
We're currently out of stock. Get notifed by email when this product available
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
The current item does not participate in the discount gift campaign. Switch the participating items to check the design.
(This prompt will not be displayed on the client-side)
Product was out of stock.
Product is unavailable.
${function() {
const postageFreeAmount = 250;
const custom_text = "Buy {amount} more to enjoy Shipping111111";
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 `
`;
}()}
/** @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}","RY")}
To display this card to customers, you need to go to "Booster & Store Conversion" to turn on the trust enhancement feature.