verbb / snipcart

A Craft CMS plugin to integrate with Snipcart.
Other
21 stars 9 forks source link

I am missing the attribute data-item-has-taxes-included="true" for the buy button #20

Closed handplant closed 4 years ago

handplant commented 4 years ago

Hello, I need the following attribute data-item-has-taxes-included="true" for the Buy Button for a german shop. The attribute is described here. https://docs.snipcart.com/v2/setup/taxes

How can I implement this with the plugin?

handplant commented 4 years ago

Okay, sorry. I got it.

    {{ entry.productDetails.getBuyNowButton({
        additionalProps: {
            'data-item-has-taxes-included': true
        }
    }) | raw }}
mattstein commented 4 years ago

You beat me to it, @handplant!

You can pass an additionalProps object to getBuyNowButton() with any additional attributes you’d like to set on the element. In this case, if productDetailsFieldHandle is your Product Details field, your template could look like this:

{{ entry.productDetailsFieldHandle.getBuyNowButton({
    additionalProps: {
        'data-item-has-taxes-included': "true",
    }
}) | raw }}

Note I’m quoting "true" above, as your example would output a 1 instead.