修改模板使用AB直连收款

主题文件 theme.liquid 添加 JS 代码

    <script>
    var redirectToShopifyCheckout = window.intercartDynCheckoutAPIConstructor('nativecheckout', 'dyn_checkout', '/checkout');
    function triggerShopifyCheckout(e) {
      if (e && e.preventDefault) {
        e.preventDefault();
      }

      if (e && e.stopPropagation) {
        e.stopPropagation();
      }

      redirectToShopifyCheckout(e);
    }
  </script>
  <script>
    function gotoShopifyCheckout(e) {
      if (e && e.preventDefault) {
        e.preventDefault();
      }

      if (e && e.stopPropagation) {
        e.stopPropagation();
      }

      window.location='/checkout';
    }
  </script>

产品页面按钮代码

 <button
              id="SectionAtcBtn-{{ section.id }}"
              type="button"
              onclick="gotoShopifyCheckout(event)"
              class="button button--secondary{% if main_product %} main-product-atc{% else %} featured-product-atc-{{ section.id }}{% endif %} button--has-spinner button--full-width product-form__submit"
              data-skip-cart-button='true'
              {% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %}
                disabled
              {% endif %}
            >
              <span class='button__label'>
                PAY WITH DEBIT/CREDIT CARD
              </span>
              <div class="loading-overlay__spinner">
                <svg
                  aria-hidden="true"
                  focusable="false"
                  class="spinner"
                  viewBox="0 0 66 66"
                  xmlns="http://www.w3.org/2000/svg"
                >
                  <circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
                </svg>
              </div>
            </button>

右侧弹出购物车代码

 <button
                  type="submit"
                  id="CartDrawer-Checkout"
                  onclick="gotoShopifyCheckout(event)"
                  class="cart__checkout-button button{% if block.settings.prefix_icon != blank %} button--prefix-icon{% endif %}{% if block.settings.suffix_icon != blank %} button--suffix-icon{% endif %}"
                  name="checkout"
                  form="CartDrawer-Form"
                  {% if cart == empty %}
                    disabled
                  {% endif %}
                >
                  <span class='button__label'>
                    PAY WITH DEBIT/CREDIT CARD
                    {% if block.settings.display_price %}
                      • {{ cart.total_price | money }}
                    {% endif %}
                  </span>
                </button>

购物车页面代码

  <button
                  type="submit"
                  id="checkout"
                  onclick="gotoShopifyCheckout(event)"
                  class="cart__checkout-button button"
                  name="checkout"
                  {% if cart == empty %}
                    disabled
                  {% endif %}
                  form="cart"
                >
                  PAY WITH DEBIT/CREDIT CARD
                </button>

已发布

分类

来自

标签:

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注