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

Wrong value for tax category after order #1103

Closed sdussaut closed 3 months ago

sdussaut commented 3 months ago

Description

As discussed here https://github.com/duncanmcclean/simple-commerce/discussions/1102, it seems that when purchased once, products get a wrong value for the tax_category entry.

Steps to reproduce

  1. Have a simple product in Statamic with tax
  2. Orders and customers are stored in DB with Eloquent
  3. Add product to cart with a single form like this one:
{{ sc:cart:addItem redirect="{{current_url}}" }}
  <input type="hidden" name="product" value="{{ id }}" />
  <input type="text" value="1" name="quantity" />
  <button type="submit">Submit</button>
{{ /sc:cart:addItem }}
  1. Complete order
  2. Check the tax_category entry on the product. The value should be default but instead is an object like this {"id":"default","name":"Default","description":"Will be used for all products where a category has not been assigned."}.

Environment

Environment Application Name: My App Laravel Version: 11.10.0 PHP Version: 8.3.3 Composer Version: 2.6.6 Environment: local Debug Mode: ENABLED URL: my-app.test Maintenance Mode: OFF

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

Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: mailcoach Queue: database Session: file

Simple Commerce Currencies: EUR, EUR Gateways: Dummy Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EloquentCustomerRepository Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EloquentOrderRepository Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Free Shipping Tax Engine: DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine

Statamic Addons: 4 Sites: 2 ([FR] Français, [EN] Anglais) Stache Watcher: Enabled Static Caching: Disabled Version: 5.9.0 PRO

Statamic Addons aryehraber/statamic-logbook: 3.3.0 duncanmcclean/simple-commerce: 7.3.1 statamic-rad-pack/runway: 7.5.1 statamic/eloquent-driver: 4.3.0

Statamic Eloquent Driver Asset Containers: eloquent Assets: eloquent Blueprints: file Collection Trees: eloquent Collections: eloquent Entries: eloquent Forms: file Global Sets: file Global Variables: file Navigation Trees: file Navigations: file Revisions: file Taxonomies: eloquent Terms: eloquent Tokens: file

sdussaut commented 3 months ago

Thank you the fix works perfectly!