根据不同的库存Shopify发货通知

时间:2018-11-09 22:24:37

标签: javascript

我正尝试根据变体库存向用户显示送货消息,然后将其作为订单项传递。目前,一切正常,您只需单击另一个变体即可。但是,该页面加载后不会显示。当页面在第一个变体上加载时,如何显示运输通知?我正在使用没有selectCallback的Debut主题。

$stockMessage = $('#stockMessage');
      $stockMessageInStock = $('#stockMessageInStock');
      $stockMessageMadeToOrder = $('#stockMessageMadeToOrder');
      $stockMessagePreOrder = $('#stockMessagePreOrder');
  if (invQty > 0 ) {
      $stockMessage.hide();
      $stockMessageMadeToOrder.hide();
      $stockMessagePreOrder.hide();
      $stockMessageInStock.show();
      $('#stock-status-prop').val('In stock - ships in 1-3 days');
    } else if (invQty > -19) {
      $stockMessage.show();
      $stockMessageMadeToOrder.show();
      $stockMessagePreOrder.hide();
      $stockMessageInStock.hide();
      $('#stock-status-prop').val('In production - ships in 1-3 weeks');
   } else {
      $stockMessage.hide();
      $stockMessageMadeToOrder.hide();
      $stockMessagePreOrder.show();
      $stockMessageInStock.hide();
      $('#stock-status-prop').val('Pre order');
   };

您可以在这里看到我的js:

http://cdn.shopify.com/s/files/1/0597/3409/t/56/assets/theme.js?6194985269805756198

实时网站:

https://roughandtumbledesign.com/collections/convertible-backpacks/products/new-generation-hobo-pack-adjustable

谢谢!

0 个答案:

没有答案