Do not render custom oxxo button in checkout

This commit is contained in:
dinamiko 2022-07-15 16:05:13 +02:00
parent 752d327188
commit d1c4850c4d
4 changed files with 64 additions and 9 deletions

View file

@ -78,11 +78,20 @@ class OXXO {
array( $this, 'register_assets' )
);
add_action(
'woocommerce_review_order_after_payment',
function () {
echo '<button style="display:none" class="button" id="ppcp-oxxo">Pago en OXXO</button>';
}
add_filter(
'woocommerce_thankyou_order_received_text',
function( string $message, WC_Order $order ) {
$payer_action = $order->get_meta( 'ppcp_oxxo_payer_action' ) ?? '';
$button = '';
if ( $payer_action ) {
$button = '<p><a id="ppcp-oxxo-payer-action" class="button" href="' . $payer_action . '" target="_blank">See OXXO Voucher/Ticket</a></p>';
}
return $message . ' ' . $button;
},
10,
2
);
}

View file

@ -129,7 +129,6 @@ class OXXOGateway extends WC_Payment_Gateway {
*/
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
$wc_order->update_status( 'on-hold', __( 'Awaiting OXXO payment.', 'woocommerce-paypal-payments' ) );
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
$payer_action = '';