Plugin Directory

Changeset 3447433


Ignore:
Timestamp:
01/27/2026 12:31:54 AM (2 months ago)
Author:
webimpian
Message:

Release 4.3.12 - Fixed checkout fee not applied on first page load for WooCommerce Blocks checkout

Location:
bayarcash-wc/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bayarcash-wc/trunk/bayarcash-wc.php

    r3392430 r3447433  
    1313 * Plugin Name:         Bayarcash WC
    1414 * Plugin URI:          https://bayarcash.com/
    15  * Version:             4.3.11
     15 * Version:             4.3.12
    1616 * Description:         Accept payment from Malaysia. Bayarcash support FPX, Direct Debit, DuitNow OBW & DuitNow QR payment channels.
    1717 * Author:              Web Impian
  • bayarcash-wc/trunk/includes/admin/js/blocks/checkout-fees.js

    r3206084 r3447433  
    44    const { subscribe, select } = wp.data;
    55
    6     subscribe(function() {
    7         const activePaymentMethod = select(PAYMENT_STORE_KEY).getActivePaymentMethod();
     6    let lastPaymentMethod = null;
     7    let initialUpdateDone = false;
     8
     9    const updatePaymentMethod = (paymentMethod) => {
     10        if (!paymentMethod) {
     11            return;
     12        }
    813        extensionCartUpdate({
    914            namespace: "bayarcash-checkout-fees",
    1015            data: {
    11                 payment_method: activePaymentMethod
     16                payment_method: paymentMethod
    1217            }
    1318        });
     19    };
     20
     21    subscribe(function() {
     22        const activePaymentMethod = select(PAYMENT_STORE_KEY).getActivePaymentMethod();
     23
     24        if (!activePaymentMethod) {
     25            return;
     26        }
     27
     28        if (activePaymentMethod !== lastPaymentMethod) {
     29            lastPaymentMethod = activePaymentMethod;
     30            updatePaymentMethod(activePaymentMethod);
     31            initialUpdateDone = true;
     32        }
    1433    }, PAYMENT_STORE_KEY);
     34
     35    // Force initial update after page load to ensure fee is calculated
     36    document.addEventListener('DOMContentLoaded', function() {
     37        setTimeout(function() {
     38            if (!initialUpdateDone) {
     39                const activePaymentMethod = select(PAYMENT_STORE_KEY).getActivePaymentMethod();
     40                if (activePaymentMethod) {
     41                    lastPaymentMethod = activePaymentMethod;
     42                    updatePaymentMethod(activePaymentMethod);
     43                    initialUpdateDone = true;
     44                }
     45            }
     46        }, 500);
     47    });
    1548})();
  • bayarcash-wc/trunk/includes/src/blocks/class-checkout-fees-blocks-integration.php

    r3206084 r3447433  
    66defined('ABSPATH') || exit;
    77
    8 define( 'BAYARCASH_BLOCK_VERSION', '1.0.0' );
     8define( 'BAYARCASH_BLOCK_VERSION', '1.0.2' );
    99
    1010
  • bayarcash-wc/trunk/readme.txt

    r3392430 r3447433  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 4.3.11
     7Stable tag: 4.3.12
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    8989== Changelog ==
    9090
     91= 4.3.12 =
     92* Fixed checkout fee not applied on first page load for WooCommerce Blocks checkout
     93* Optimized payment method change detection to reduce unnecessary API calls
     94
    9195= 4.3.11 =
    9296* Fixed minor bugs
Note: See TracChangeset for help on using the changeset viewer.