【问题标题】:Adjusting the arguments of WooCommerce add-to-cart shortcode not working调整 WooCommerce 添加到购物车短代码的参数不起作用
【发布时间】:2020-08-26 05:13:33
【问题描述】:

我正在尝试在随机页面上使用 Woocommerce 短代码来创建“添加到购物车”按钮。我不希望显示价格,也不希望默认的灰色边框。我想我应该这样制作简码: [add_to_cart id="34022" style="0" show_price="FALSE"]

但不知何故,添加的参数没有被考虑在内。就像我只放这个一样:

[add_to_cart id="34022"]

我也尝试使用除“0”之外的其他内联样式,但我所做的一切都没有改变。我不明白我做错了什么......它似乎根本没有回应。

【问题讨论】:

    标签: wordpress woocommerce product shortcode wordpress-shortcode


    【解决方案1】:

     

    [add_to_cart id="34022" style=" " show_price="false"] 
    

    试试这个简码

    这些是具有默认值的可用属性。

        $atts = shortcode_atts(
            array(
                'id'         => '',
                'class'      => '',
                'quantity'   => '1',
                'sku'        => '',
                'style'      => 'border:4px solid #ccc; padding: 12px;',
                'show_price' => 'true',
            ),
            $atts,
            'product_add_to_cart'
        );
    

    【讨论】:

    • 感谢您的回答 - 我完全忘记了这篇文章。我现在尝试了,但它没有改变任何东西。是否可以在某处覆盖这些默认样式?
    猜你喜欢
    • 1970-01-01
    • 2013-07-15
    • 1970-01-01
    • 2015-10-10
    • 2020-12-13
    • 2017-06-28
    • 2012-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多