Plugin Directory

Changeset 2987178


Ignore:
Timestamp:
11/01/2023 05:08:22 AM (2 years ago)
Author:
blockonomics
Message:

Made plugin woocommerce HPOS compatible

Location:
blockonomics-bitcoin-payments/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • blockonomics-bitcoin-payments/trunk/blockonomics-woocommerce.php

    r2984526 r2987178  
    44 * Plugin URI: https://github.com/blockonomics/woocommerce-plugin
    55 * Description: Accept Bitcoin Payments on your WooCommerce-powered website with Blockonomics
    6  * Version: 3.6.7
     6 * Version: 3.6.8
    77 * Author: Blockonomics
    88 * Author URI: https://www.blockonomics.co
     
    573573add_action('admin_notices', 'blockonomics_plugin_activation');
    574574
     575add_action( 'before_woocommerce_init', function() {
     576    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     577        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     578    }
     579} );
     580
    575581global $blockonomics_db_version;
    576582$blockonomics_db_version = '1.4';
  • blockonomics-bitcoin-payments/trunk/php/Blockonomics.php

    r2984526 r2987178  
    516516    // Save the new address to the WooCommerce order
    517517    public function record_address($order_id, $crypto, $address){
     518        $wc_order = wc_get_order( $order_id );
    518519        $addr_meta_key = 'blockonomics_payments_addresses';
    519         $addr_meta_value = get_post_meta($order_id, $addr_meta_key);
     520        $addr_meta_value = $wc_order->get_meta($addr_meta_key);
    520521        if (empty($addr_meta_value)){
    521             update_post_meta($order_id, $addr_meta_key, $address);
     522            $wc_order->update_meta_data( $addr_meta_key, $address );
    522523        }
    523524        // when address meta value is not empty and $address is not in it
    524         else if (strpos($addr_meta_value[0], $address) === false) {
    525             update_post_meta($order_id, $addr_meta_key, $addr_meta_value[0]. ', '. $address);
    526         }
     525        else if (strpos($addr_meta_value, $address) === false) {
     526            $wc_order->update_meta_data( $addr_meta_key, $addr_meta_value. ', '. $address );
     527        }
     528        $wc_order->save();
    527529    }
    528530
     
    784786    public function save_transaction($order, $wc_order){
    785787        $txid_meta_key = 'blockonomics_payments_txids';
    786         $txid_meta_value = get_post_meta($order['order_id'], $txid_meta_key);
     788        $txid_meta_value = $wc_order->get_meta($txid_meta_key);
    787789        $txid = $order['txid'];
    788790        if (empty($txid_meta_value)){
    789             update_post_meta($wc_order->get_id(), $txid_meta_key, $txid);
     791            $wc_order->update_meta_data($txid_meta_key, $txid);
    790792        }
    791793        // when txid meta value is not empty and $txid is not in it
    792         else if (strpos($txid_meta_value[0], $txid) === false){
    793             update_post_meta($wc_order->get_id(), $txid_meta_key, $txid_meta_value[0].', '. $txid);
    794         }
     794        else if (strpos($txid_meta_value, $txid) === false){
     795            $wc_order->update_meta_data($txid_meta_key, $txid_meta_value.', '. $txid);
     796        }
     797        $wc_order->save();
    795798    }
    796799
  • blockonomics-bitcoin-payments/trunk/readme.txt

    r2984526 r2987178  
    44Requires at least: 3.0.1
    55Tested up to: 6.3.1
    6 Stable tag: 3.6.7
     6Stable tag: 3.6.8
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
     
    8484== Changelog ==
    8585
     86= 3.6.8  =
     87* Made plugin Woocommerce HPOS compatible
     88
    8689= 3.6.7  =
    8790* Fix shortcode execution with page builders
Note: See TracChangeset for help on using the changeset viewer.