Skip to content

Commit

Permalink
Set home delivery to false if shippingMethods is instore pickup or si…
Browse files Browse the repository at this point in the history
…milar
  • Loading branch information
m1k3lm committed Jan 9, 2025
1 parent 8792592 commit 62bfa45
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
40 changes: 33 additions & 7 deletions Model/Api/Builders/CreateOrderRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,48 @@ public function isAllowedFor(GeneralSettingsResponse $generalSettingsResponse):

private function generateCreateOrderRequest(): CreateOrderRequest
{
//@var string
$shippingMethod = $this->quote->getShippingAddress()->getShippingMethod();
return CreateOrderRequest::fromArray([
'state' => '',
'merchant' => $this->getMerchantData(),
// 'merchant_reference' => [
// 'order_ref_1' => $request->getOrder()->getId(),
// ],
'cart' => $this->getCart(),
'delivery_method' => [
'name' => $this->quote->getShippingAddress()->getShippingMethod(),
'name' => $shippingMethod,
'home_delivery' => !in_array(
$shippingMethod,
[
//Magento MSI In-Store Pickup (BOPIS)
'msi_instore_pickup',
'instore_pickup',
//Amasty Store Pickup
'amstorepickup_amstorepickup',
'amstorepickup_storepickup',
//Mageplaza Store Pickup
'mageplaza_storepickup',
//Mirasvit Store Pickup
'mirasvit_pickup',
'mirasvit_storepickup',
//MageWorx Store Pickup
'mageworx_storepickup',
'mageworx_instore_pickup',
//Webkul Store Pickup
'webkul_storepickup',
//Other/Generic or Custom Store Pickup
'storepickup_storepickup',
'pickup_storepickup',
'clickandcollect_clickandcollect',
'instorepickup_instorepickup',
'pickup_pickup',
'clickandcollect',
'pick_instore',
'pickup',
]
),
],
'delivery_address' => $this->getAddress($this->quote->getShippingAddress()),
'invoice_address' => $this->getAddress($this->quote->getBillingAddress()),
'customer' => $this->getCustomer(),
// 'instore' => [
// 'code' => $request->getOrder()->getId(),
// ],
'gui' => [
'layout' => 'desktop',
],
Expand Down
2 changes: 1 addition & 1 deletion bin/n98-magerun2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
docker compose exec -u daemon -w /bitnami/magento magento bash -c \
"[ ! -f 'vendor/bin/n98-magerun2' ] && vendor/bin/composer require n98/magerun2-dist"
"[ ! -f 'vendor/bin/n98-magerun2' ] && php vendor/bin/composer require n98/magerun2-dist"
docker compose exec -u daemon -w /bitnami/magento magento vendor/bin/n98-magerun2 $@
2 changes: 1 addition & 1 deletion bin/update-sources
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker cp ${COMPOSE_PROJECT_NAME:-sequra}-magento:/var/www/html .magento-src
docker cp ${COMPOSE_PROJECT_NAME:-magento2-core}-magento:/bitnami/magento .magento-src

0 comments on commit 62bfa45

Please sign in to comment.