Skip to content

Commit

Permalink
Add 'crypto' custom route issue #154
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrenWestwood committed Oct 8, 2019
1 parent f4e2e61 commit 122a360
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions blockonomics-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ function blockonomics_woocommerce_init()
add_action('woocommerce_email_customer_details', 'nolo_bnomics_woocommerce_email_customer_details', 10, 1);
add_filter('woocommerce_payment_gateways', 'woocommerce_add_blockonomics_gateway');
add_filter('clean_url', 'bnomics_async_scripts', 11, 1 );
add_action('init', 'custom_rewrite_rules');

/* Custom Rewrite Rule */
function custom_rewrite_rules() {
add_rewrite_rule( 'crypto/?$', 'index.php?wc-api=WC_Gateway_Blockonomics', 'top' );
}

/**
* Add this Gateway to WooCommerce
Expand Down
3 changes: 2 additions & 1 deletion php/WC_Gateway_Blockonomics.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function process_payment($order_id)
update_option('blockonomics_orders', $blockonomics_orders);
$order_url = WC()->api_request_url('WC_Gateway_Blockonomics');
$order_url = add_query_arg('show_order', $address, $order_url);

$order_url = str_replace('wc-api/WC_Gateway_Blockonomics', 'crypto', $order_url);

update_post_meta($order_id, 'blockonomics_address', $address);

return array(
Expand Down

0 comments on commit 122a360

Please sign in to comment.