duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
146 stars 40 forks source link

Call to a member function can() on null when adding Taxonomy Terms input to Product Variants field. #1076

Closed sbrow closed 4 months ago

sbrow commented 4 months ago

Description

I've created a "Shipping Class" taxonomy so I can assign prices to products based on their size/weight. Some of my products have a different shipping class based on their product variant (I'm using quantity based pricing). Everything works fine until I add the "Shipping Class" taxonomy term fieldtype into the "Product Variants" fieldtype, at which point, Guest Users are no longer able to view the "Products" page.

ppn test_shop

Steps to reproduce

  1. Log in as an admin.
  2. Create a new taxonomy and assign it to products.
  3. Add a "taxonomy terms" fieldtype to the "product variants" field in your "Variable Product" blueprint.
  4. Log out
  5. Visit the "products/shop" page.

Environment

Environment Application Name: Laravel Version: 11.7.0 PHP Version: 8.2.13 Composer Version: 2.6.5 Environment: local Debug Mode: ENABLED URL: Maintenance Mode: OFF

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: null Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file

Simple Commerce Currencies: USD Gateways: Stripe Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\UserCustomerRepository Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EntryOrderRepository Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Free Shipping Tax Engine: DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine

Sentry Enabled: MISSING DSN Environment: local Laravel SDK Version: 4.5.1 PHP SDK Version: 4.7.0 Release: NOT SET Sample Rate Errors: 100% Sample Rate Performance Monitoring: 100% Sample Rate Profiling: NOT SET Send Default PII: DISABLED

Statamic Addons: 7 Sites: 1 Stache Watcher: Enabled Static Caching: Disabled Version: 5.0.2 PRO

Statamic Addons arthurperton/wordpress-users: 1.1.1 duncanmcclean/guest-entries: 4.0.0 duncanmcclean/simple-commerce: 7.0.1 sbrow/sc-checkout: dev-5dcefce85614781a2529c6b0ad8ae8c661a7bb0c sbrow/sc-subscriptions: dev-5dcefce85614781a2529c6b0ad8ae8c661a7bb0c sbrow/banner: dev-5dcefce85614781a2529c6b0ad8ae8c661a7bb0c statamic/seo-pro: 6.0.1

sbrow commented 4 months ago

Hi @duncanmcclean, I've looked into this issue and determined that the "root" cause of the issue actually lies in the underlying Statamic code. If they accept my PR (statamic/cms#10232), then I will close this issue; but if they feel a need to require users to authenticate before calling \Statamic\Fields\Fields->getCreatables(), then it'd be simple commerce that needs an update in order to work (for me), in which case I'd start a separate PR here.

Keep up the good work! :smile:

github-actions[bot] commented 4 months ago

Released as part of v7.2.1.

sbrow commented 4 months ago

That solved the problem for me. Thank you kindly!