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

Attempting to update an order fails with "Shipping Method Must be a String" #1147

Closed sbrow closed 1 month ago

sbrow commented 1 month ago

Description

Whenever I try to update a placed order, The validation fails, claiming the shipping method must be a string. This happens both if there is a valid shipping method, and also if the shipping method is blank.

image

image

Order blueprint (part of it)

title: Order
tabs:
  main:
    display: Main
    sections:
      -
        display: 'Order Details'
        fields:
          -
            handle: title
            field:
              type: text
              required: false
              width: 50
              validate:
                - required
              listable: true
              visibility: hidden
          -
            handle: order_number
            field:
              type: hidden
              width: 50
          -
            handle: customer
            field:
              max_items: 1
              mode: default
              type: users
              display: Customer
              width: 50
              visibility: read_only
          -
            handle: coupon
            field:
              max_items: 1
              type: coupon
              display: Coupon
              width: 50
              visibility: read_only
          -
            handle: shipping_method
            field:
              display: 'Shipping Method'
              type: shipping_method
              width: 50
              visibility: read_only
          -
            handle: affiliate
            field:
              max_items: 1
              query_scopes:
                - is_affiliate
              type: users
              display: 'Assigned to Affiliate'
              instructions: 'Whom should be credited with this sale'
              width: 50

#   ...

Steps to reproduce

  1. Create a shipping provider
  2. Add a non read-only field to the order blueprint (mine was a users type)
  3. Go through the checkout process using the shipping provider you created.
  4. Navigate to the order you made in the CP, and attempt to update the field you created in step 2.

Environment

Environment Application Name: <REDACTED> Laravel Version: 11.20.0 PHP Version: 8.2.13 Composer Version: 2.6.5 Environment: local Debug Mode: ENABLED URL: <REDACTED>.test Maintenance Mode: OFF Timezone: America/New_York Locale: en

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

Drivers Broadcasting: null Cache: file 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: Flat Rate Shipping, 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: 8 Sites: 1 Stache Watcher: Enabled Static Caching: Disabled Version: 5.22.0 PRO

Statamic Addons arthurperton/wordpress-users: 1.2.0 duncanmcclean/guest-entries: 4.0.1 duncanmcclean/simple-commerce: 7.4.2 <REDACTED>/sc-affiliates: dev-8121e749b3eef1457b7bede10f2ddec0254748b4 <REDACTED>/sc-checkout: dev-8121e749b3eef1457b7bede10f2ddec0254748b4 <REDACTED>/sc-subscriptions: dev-8121e749b3eef1457b7bede10f2ddec0254748b4 sbrow/banner: dev-8121e749b3eef1457b7bede10f2ddec0254748b4 statamic/seo-pro: 6.0.3

github-actions[bot] commented 1 month ago

Released as part of v7.4.5.

sbrow commented 1 month ago

Thank you :)