Plugin Directory

Changeset 3245117


Ignore:
Timestamp:
02/23/2025 03:57:19 AM (13 months ago)
Author:
webimpian
Message:

Add support {total} for submit order button

Location:
bayarcash-wc
Files:
385 added
4 edited

Legend:

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

    r3235759 r3245117  
    1313 * Plugin Name:         Bayarcash WC
    1414 * Plugin URI:          https://bayarcash.com/
    15  * Version:             4.3.4
     15 * Version:             4.3.5
    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/src/AdminFormFields.php

    r3185027 r3245117  
    135135                'title'       => esc_html__('Place Order Text', $payment_method . '-wc'),
    136136                'type'        => 'text',
    137                 'description' => esc_html__('This is the text for place order button.', $payment_method . '-wc'),
     137                'description' => esc_html__('This is the text for place order button. Use {total} to display the cart total amount (e.g., "Pay {total}" will show as "Pay RM 50.00").', $payment_method . '-wc'),
    138138                'desc_tip'    => true,
    139139                'default'     => esc_html__('Pay with ' . ucfirst($titles['title']), $payment_method . '-wc'),
    140                 'placeholder' => esc_html__('This is the text for place order button', $payment_method . '-wc'),
     140                'placeholder' => esc_html__('Enter text for place order button (e.g., Pay {total})', $payment_method . '-wc'),
    141141            ],
    142142        ];
  • bayarcash-wc/trunk/includes/src/Gateway.php

    r3235759 r3245117  
    8585    {
    8686        $custom_text = AdminFormFields::custom_order_button_text($this->id, $this->get_option('place_order_text'));
    87         return $custom_text !== null ? $custom_text : $order_button_text;
     87
     88        if ( empty($custom_text) ) {
     89            return $order_button_text;
     90        }
     91
     92        if (strpos($custom_text, '{total}') !== false) {
     93            $cart_total = wp_strip_all_tags(wc_price(WC()->cart->total));
     94            $custom_text = str_replace('{total}', $cart_total, $custom_text);
     95        }
     96        return $custom_text;
    8897    }
    8998
  • bayarcash-wc/trunk/readme.txt

    r3235759 r3245117  
    55Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 4.3.4
     7Stable tag: 4.3.5
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    8989== Changelog ==
    9090
     91= 4.3.5 =
     92* Added support for {total} placeholder in payment button text
     93* Button text will fall back to default WooCommerce text if custom text is empty
     94
    9195= 4.3.4 =
    9296* Improved the cron requery process
Note: See TracChangeset for help on using the changeset viewer.