verbb / snipcart

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

SnipCart Button doesn't work when Classes applied to it #64

Closed DynamiteGoesBoom closed 9 months ago

DynamiteGoesBoom commented 9 months ago

Describe the bug

Hey Crawf,

First of all, thank you for taking this plugin over as I know it's in great hands :)

So I'm reconfiguring this for Fido and using the following code to render a button:

{{ entry.productDetails.getBuyNowButton({
              image: entry.photos.one().url,
              class: ['flex max-w-xs flex-1 items-center justify-center rounded-md border border-transparent bg-primary px-8 py-3 text-base font-medium text-white hover:bg-black focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-gray-50 sm:w-full']
            }) }}

But when I use class it doesn't add anything to the cart.

it doesn't seem to matter what's in there and the moment I remove the class property then it works as expected.

Also the sidebar SnipCart link needs updating. When I click on "Snipcart" from the Dashboard's Sidebar menu it takes me here:

https://fido.ddev.site/admin/snipcart

Screenshot 2024-02-28 at 1 58 08 PM

Yet when I visit https://fido.ddev.site/admin/snipcart/settings there is no error so I think just updating the URL there should fix it.

Steps to reproduce

  1. Add a class array to the getBuyNowButton method
  2. Try and add something to your cart

Craft CMS version

4.7.4

Plugin version

2.1.4

Multi-site?

No

Additional context

No response

engram-design commented 9 months ago

Should be fixed for the next release. To get this early, run composer require verbb/snipcart:"dev-craft-4 as 2.1.4".

As for clicking the "Snipcart" link in the main menu, that should take you to the dashboard, and it does for me. Are your credentials actually valid - I assume they are? But something is throwing an error when trying to fetch data. Going to admin/snipcart/settings from the sidebar isn't correct behaviour, as that'll be unavailable on production due to allowAdminChanges = false being set.

engram-design commented 9 months ago

Fixed in 2.1.5