Open friendscottn opened 4 years ago
Here's a patch that resolves the issue for us:
diff --git a/vendor/subscribepro/subscribepro-magento2-ext/Block/Adminhtml/Payment/Cc.php b/vendor/subscribepro/subscribepro-magento2-ext/Block/Adminhtml/Payment/Cc.php
index 98367f61a..cdca660d8 100644
--- a/vendor/subscribepro/subscribepro-magento2-ext/Block/Adminhtml/Payment/Cc.php
+++ b/vendor/subscribepro/subscribepro-magento2-ext/Block/Adminhtml/Payment/Cc.php
@@ -51,4 +51,15 @@ class Cc extends \Magento\Payment\Block\Form\Cc
{
return ConfigProvider::CODE;
}
+
+ // BANYAN MOD: Fixing admin guest checkout
+ /**
+ *
+ * @return bool
+ */
+ public function getQuoteHasCustomer()
+ {
+ return $this->quoteSession->getQuote()->getCustomerId() !== null;
+ }
+ // END BANYAN MOD
}
diff --git a/vendor/subscribepro/subscribepro-magento2-ext/view/adminhtml/templates/payment/cc.phtml b/vendor/subscribepro/subscribepro-magento2-ext/view/adminhtml/templates/payment/cc.phtml
index afa39615d..18f72135c 100644
--- a/vendor/subscribepro/subscribepro-magento2-ext/view/adminhtml/templates/payment/cc.phtml
+++ b/vendor/subscribepro/subscribepro-magento2-ext/view/adminhtml/templates/payment/cc.phtml
@@ -64,5 +64,7 @@ $code = $block->escapeHtml($block->getMethodCode());
</div>
<input type="hidden" id="<?php echo $code; ?>_payment_method_token" name="payment[payment_method_token]"/>
- <input name="payment[is_active_payment_token_enabler]" type="hidden" value="true" />
+ <!-- BANYAN MOD: Fixing admin guest checkout -->
+ <input name="payment[is_active_payment_token_enabler]" type="hidden" value="<?= $block->getQuoteHasCustomer() ? 'true' : 'false'; ?>" />
+ <!-- END BANYAN MOD -->
</fieldset>
The issue
I know most people don't use the subscribe pro payment method for guest orders. But if you do you'll get an error when trying to use the reorder functionality in the admin:
Which is masking:
vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/AbstractProfileCreatorCommand.php
The solution
The payment form has the hidden field payment[is_active_payment_token_enabler] hard coded to 'true'. This should be false for guest orders.