• Resolved alexisacseo

    (@alexisacseo)


    Hello,

    Accordording to the documentation about migration to 4, i want to override my checkout attribute.
    I see for example that :
    Removed JS hook cart.subtotal.text. Use shortcode attribute subtotal_label_text instead

    with the php function :

    
    $products_args['items_per_row'] = '3';
    $products_args['add_to_cart_button_text'] = 'Ajouter au panier';
    $products_args['subtotal_label_text'] = 'my total';
    $Products->products(
            apply_filters('shopwp_products_all_args', $products_args)
        );

    i apply some parameter to customize the rending.

    i have try to add the key ‘subtotal_label_text’ but the render don’t display my overriding value for this key, but it’s ok for the key add_to_cart_button_text for example.

    To debug this i have try to print the setted attribute in the class :
    wpshopify/classes/render/class-attributes.php before the return in the function attr :

     echo $attr_name.' : '.$attrs[$attr_name].'<br>';
            return $attrs[$attr_name];

    in my front page i can see the print :

    ....
    link_to : wordpress
    link_target : _self
    link_with_buy_button : true
    full_width : false
    add_to_cart_button_text : Ajouter au panier

    …`

    And i can see that the keys subtotal_label_text, cart_title, lineitem_remove_text… are not setted.

    Do you know why ?
    Is there a filter to do that ?
    Is there another way to override the text for subtotal_label_text, lineitem_remove_text…

    thanks in advance

    • This topic was modified 2 years, 9 months ago by alexisacseo.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author andrewmrobbins

    (@andrewmrobbins)

    @alexisacseo

    Hey,

    Sorry this is my mistake. I provided the wrong workaround in the changelog.

    Instead of adding it to shopwp_products_all_args, you’ll want to add it to shopwp_cart_default_payload_settings instead. Like this:

    
    add_filter('shopwp_cart_default_payload_settings', function($settings) {
        
        $settings['subtotal_label_text'] = 'My total';
    
        return $settings;
    
    });
    

    Does this help?

    Thread Starter alexisacseo

    (@alexisacseo)

    Problem resolved with the filter : shopwp_cart_default_payload_settings

    add_filter('shopwp_cart_default_payload_settings', function($cart_settings) {
        $cart_settings['cart_title'] = "my title"
        $cart_settings['subtotal_label_text'] = "my total";
        return $cart_settings;
    });
    Thread Starter alexisacseo

    (@alexisacseo)

    thanks for your feedback, i have found the best way in the same time of your answer ??

    Plugin Author andrewmrobbins

    (@andrewmrobbins)

    Awesome! Glad you got it working ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Overiding attibute values’ is closed to new replies.