4.13 SilverShop shipping - Multistep checkout

Silverstripe Version:
4.13

Question:

I’m trying to get the stepped checkout working with SilverShop, have followed all instructions and have this in config.yml


SilverShop\Extension\ShopConfigExtension:
  base_currency: 'EUR'

SilverShop\ORM\FieldType\ShopCurrency:
  base_currency: 'EUR' 
  currency_symbol: '€'
  decimal_delimiter: ','
  thousand_delimiter: '.'
  append_symbol: true

SilverShop\Model\Order:
  modifiers:
    - SilverShop\Shipping\ShippingFrameworkModifier

SilverShop\Page\CheckoutPage:
    steps:
        'membership': 'CheckoutStep_Membership'
        'contactdetails': 'CheckoutStep_ContactDetails'
        'shippingaddress': 'CheckoutStep_Address'
        'billingaddress': 'CheckoutStep_Address'
        'shippingmethod': 'CheckoutStep_ShippingMethod' #extra line for shipping method
        'paymentmethod': 'CheckoutStep_PaymentMethod'
        'summary': 'CheckoutStep_Summary'

I also removed the snippet of code in config.php which when present crashes dev/build so I guess it’s the correct one. It’s not exactly the same function written in the doc so not sure if wrongly written in the documentation or if I made a mistake, but this is my config.php

use SilverShop\Extension\SteppedCheckoutExtension;
use SilverShop\Page\CheckoutPage;

/*if($checkoutsteps = CheckoutPage::config()->steps){
  SteppedCheckoutExtension::setupSteps($checkoutsteps);
} */

so from there I do a dev/build, but couldn’t enter into the Shipping rates admin panel due to an error with an attribution to null

[2024-01-19 18:01:10] error-log.WARNING: E_DEPRECATED: number_format(): Passing null to parameter #1 ($num) of type float is deprecated {“code”:8192,“message”:“number_format(): Passing null to parameter #1 ($num) of type float is deprecated”,“file”:"/vendor/silvershop/shipping/src/Model/ShippingMethod.php",“line”:55}

I can enter by tweaking the SilverShop\Shipping\Model\ShippingMethod
(I guess I should not but I tried to find answers and nothing else worked)


// Check if $this->Rate is not null before formatting
        if ($this->Rate !== null) {
            $rate = number_format(
                $this->Rate,
                2,
                ShopCurrency::config()->decimal_delimiter,
                ShopCurrency::config()->thousand_delimiter
            );
        } else {
            // Handle the case where $this->Rate is null
            $rate = 'N/A'; // Or any default value you prefer
        }

So I could set up a shipping rate and it’s showing up when I use the Shipping Estimator, so up to the cart it seems to work. Then I go to the checkout, and I can see the line Shipping in the cart subtotal calculation but it stays at 0 and I don’t see anything looking like a stepped checkout nor any shipping method to select. Then I enter the address to see if anything responds and it doesn’t. So I make a dummy order just in case a rate appears when ordering but no shipping is calculated either in the final order.

So do I have to create pages for the stepped checkout and create a logic myself, or else?

I also installed SilverShop on a fresh install of SilverStripe 5 via composer to check if I would have more luck, but it was exactly the same behavior.

I already tried to get some help in the plugin Issues tab so maybe someone has seen it already, but up to now I didn’t find any solution. I didn’t change the core of SilverShop, installed everything via composer.

I’m clueless, thanks for any information.

Any insight is welcome

Ok, so finally I got the answer, I found out that the code inside the documentation doesn’t reflect the actual names of the classes to use. That’s what should be added to the .yml

SilverShop\Page\CheckoutPage:
steps:
‘membership’: ‘SilverShop\Checkout\Step\Membership’
‘contactdetails’: ‘SilverShop\Checkout\Step\ContactDetails’
‘shippingaddress’: ‘SilverShop\Checkout\Step\Address’
‘billingaddress’: ‘SilverShop\Checkout\Step\Address’
‘shippingmethod’: ‘SilverShop\Shipping\Checkout\Step\CheckoutStepShippingMethod’ #extra line for shipping method
‘paymentmethod’: ‘SilverShop\Checkout\Step\PaymentMethod’
‘summary’: ‘SilverShop\Checkout\Step\Summary’