Skip to content

Commit

Permalink
Merge pull request #4 from mageworx/update_march_22
Browse files Browse the repository at this point in the history
Bugfixes for new Pickup module version
  • Loading branch information
SiarheyUchukhlebau authored Mar 31, 2022
2 parents 2acd260 + 1093185 commit f28da75
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
23 changes: 23 additions & 0 deletions Observer/CheckoutLayoutModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
*/
class CheckoutLayoutModifier implements ObserverInterface
{

/**
* @var \Magento\Checkout\Model\Session\Proxy
*/
protected $checkoutSession;

/**
* @param \Magento\Checkout\Model\Session\Proxy $checkoutSession
*/
public function __construct(
\Magento\Checkout\Model\Session\Proxy $checkoutSession
) {
$this->checkoutSession = $checkoutSession;
}

/**
* @inheritDoc
*/
Expand All @@ -30,6 +45,14 @@ public function execute(Observer $observer)
$originalElement = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['pickupInformation']['children']['shippingAdditional'];

if ($this->checkoutSession->getQuote() && $this->checkoutSession->getQuote()->getIsVirtual()) {
// Remove pickup for virtual quote and return
unset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['pickupInformation']);

return;
}

$originalElement['component'] = 'MageWorx_PickupCheckout/js/view/checkout/select-store-container';
$originalElement['config']['template'] = 'MageWorx_PickupCheckout/checkout/select-store-container';

Expand Down
10 changes: 8 additions & 2 deletions Plugin/AbstractAddDataToOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ protected function out($entity)
return true;
}

$methodCode = $entity->getShippingAddress()->getShippingMethod();
if ($entity->getIsVirtual()) {
return true;
}

if ($entity->getShippingAddress()) {
$methodCode = $entity->getShippingAddress()->getShippingMethod();
}

if (!$methodCode) {
if (empty($methodCode)) {
$methodCode = $entity->getShippingMethod();
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"mageworx/module-checkout": ">=1.0.0"
},
"type": "magento2-module",
"version": "1.0.2",
"version": "1.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/template/checkout/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<!-- Set additional data for the shipping method here (when selected) -->
<div class="radiogroup__content">
<div class="form form--condensed">
<each args="getRegion('shipping_method_additional_data')" render=""/>
<each args="$parent.getRegion('shipping_method_additional_data')" render=""/>
</div>
</div>
</div>
Expand Down

0 comments on commit f28da75

Please sign in to comment.