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

Class DoubleThreeDigital\SimpleCommerce\Data\Address is not available #1054

Closed wautersj closed 5 months ago

wautersj commented 5 months ago

Description

Trying to create a custom shipping method. So firstly created the class and used the example. But in the example there is a reference to an Address class which is not in the Data folder of SC anymore.

Could not check compatibility between App\ShippingMethods\CustomShipping::checkAvailability(DoubleThreeDigital\SimpleCommerce\Contracts\Order $order, DoubleThreeDigital\SimpleCommerce\Data\Address $address): bool and DoubleThreeDigital\SimpleCommerce\Contracts\ShippingMethod::checkAvailability(DoubleThreeDigital\SimpleCommerce\Contracts\Order $order, DoubleThreeDigital\SimpleCommerce\Orders\Address $address): bool, because class DoubleThreeDigital\SimpleCommerce\Data\Address is not available

(Also, the documentation class references need updating, it still states 'DuncanMcClean', instead of 'DoubleThreeDigital'.)

I'll give some more info on why I want a custom shipping method in the first place. I would like to have a fixed shipping price (for example 10$), for any kind of order. Either the order has 1 item or 20, it should not impact the shipping cost.

Steps to reproduce

  1. Create custom shipping method class.
  2. Assign in the SC config.
  3. Visit the shop checkout.

Environment

I'm afraid running this command gives me the same error, but in the terminal.

Could not check compatibility between App\ShippingMethods\CustomShipping::checkAvailability(DoubleThreeDigital\SimpleCommerce\Contracts\Order $order, DoubleThreeDigital\SimpleCommerce\Data\Address $address): bool and DoubleThreeDigital\SimpleCommerce\Contracts\ShippingMethod::checkAvailability(DoubleThreeDigital\SimpleCommerce\Contracts\Order $order, DoubleThreeDigital\SimpleCommerce\Orders\Address $address): bool, because class DoubleThreeDigital\SimpleCommerce\Data\Address is not available

at app/ShippingMethods/CustomShipping.php:27 23▕ { 24▕ return 123; 25▕ } 26▕ ➜ 27▕ public function checkAvailability(Order $order, Address $address): bool 28▕ { 29▕ return true; 30▕ } 31▕ }

duncanmcclean commented 5 months ago

Thanks! I'll get the docs updated. You should be able to import DuncanMcClean\SimpleCommerce\Orders\Address instead.

wautersj commented 5 months ago

@duncanmcclean That works. Thanks!