Plugin Directory

Changeset 3350444


Ignore:
Timestamp:
08/26/2025 01:02:59 PM (6 months ago)
Author:
razorpay
Message:

Update: 4.7.7

Location:
woo-razorpay/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • woo-razorpay/trunk/readme.txt

    r3331331 r3350444  
    44Requires at least: 3.9.2
    55Tested up to: 6.8
    6 Stable tag: 4.7.6
     6Stable tag: 4.7.7
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    6969
    7070== Changelog ==
     71
     72= 4.7.7 =
     73* Added support for WooCommerce Cart Blocks.
     74* Fixed script enqueue issue for Magic Checkout.
     75* Fixed guest checkout issue for existing users in Magic Checkout.
    7176
    7277= 4.7.6 =
  • woo-razorpay/trunk/woo-razorpay.php

    r3331331 r3350444  
    44 * Plugin URI: https://razorpay.com
    55 * Description: Razorpay Payment Gateway Integration for WooCommerce.Razorpay Welcome Back Offer: New to Razorpay? Sign up to enjoy FREE payments* of INR 2 lakh till March 31st! Transact before January 10th to grab the offer.
    6  * Version: 4.7.6
    7  * Stable tag: 4.7.6
     6 * Version: 4.7.7
     7 * Stable tag: 4.7.7
    88 * Author: Team Razorpay
    9  * WC tested up to: 9.1.2
     9 * WC tested up to: 10.1.1
    1010 * Author URI: https://razorpay.com
    1111*/
     
    27142714                rzpLogInfo("updateOrderAddress function executed");
    27152715
     2716                $email = $razorpayData['customer_details']['email'];
     2717
     2718                if (empty($email) === false)
     2719                {
     2720                    $user = get_user_by('email', $email);
     2721
     2722                    if ($user)
     2723                    {
     2724                        $user_id = $user->ID;
     2725                        $order->set_customer_id($user_id);
     2726                    }
     2727                }
     2728
    27162729                $order->save();
    27172730            }
     
    33613374    wp_register_script('1cc_razorpay_checkout', RZP_CHECKOUTJS_URL, null, null);
    33623375    wp_enqueue_script('1cc_razorpay_checkout');
    3363     wp_register_style(RZP_1CC_CSS_SCRIPT, plugin_dir_url(__FILE__)  . 'public/css/1cc-product-checkout.css', null, null);
    3364     wp_enqueue_style(RZP_1CC_CSS_SCRIPT);
    33653376
    33663377    wp_register_script('btn_1cc_checkout', BTN_CHECKOUTJS_URL, null, null);
     
    33763387}
    33773388
     3389// Enqueue scripts for cart block 1CC
     3390function enqueueCartBlockScriptsFor1cc()
     3391{
     3392    if (is_cart() && has_block('woocommerce/cart')) {
     3393        // Enqueue cart block specific script
     3394        wp_register_script('cart_block_1cc', plugin_dir_url(__FILE__) . 'public/js/cart-block-1cc.js', array('jquery'), null, true);
     3395        wp_enqueue_script('cart_block_1cc');
     3396    }
     3397}
     3398
    33783399//To add 1CC button on cart page.
    33793400add_action( 'woocommerce_proceed_to_checkout', 'addCheckoutButton');
     
    33823403   add_action('wp_head', 'injectMerchantKeyMeta', 1);
    33833404   add_action('wp_head', 'addRzpSpinner');
     3405   add_action('wp_enqueue_scripts', 'enqueueScriptsFor1ccConditionally');
     3406   // Add support for cart blocks
     3407   add_action( 'wp_footer', 'addCartBlockSupport');
     3408}
     3409
     3410function enqueueScriptsFor1ccConditionally()
     3411{
     3412    if (class_exists('WooCommerce'))
     3413    {
     3414        enqueueScriptsFor1cc();
     3415    }
     3416    // loading file as it contains spinner css
     3417    wp_enqueue_style(RZP_1CC_CSS_SCRIPT, plugin_dir_url(__FILE__)  . 'public/css/1cc-product-checkout.css', [], null);
    33843418}
    33853419
    33863420function addCheckoutButton()
    33873421{
    3388   add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);
    3389 
    33903422  if (isRazorpayPluginEnabled() && is1ccEnabled() )
    33913423  {
     
    34073439}
    34083440
     3441// Adds Magic Checkout button on WooCommerce Cart Block pages
     3442function addCartBlockSupport()
     3443{
     3444    if (is_cart() && has_block('woocommerce/cart'))
     3445    {
     3446        if (isTestModeEnabled()) {
     3447            $current_user = wp_get_current_user();
     3448            if (!($current_user->has_cap('administrator') || preg_match('/@razorpay.com$/i', $current_user->user_email))) {
     3449                return;
     3450            }
     3451        }
     3452        // Enqueue cart block specific scripts
     3453        enqueueCartBlockScriptsFor1cc();
     3454       ?>
     3455       <style type="text/css">
     3456       /* Hide default cart block buttons when Razorpay 1CC is active */
     3457       .wp-block-woocommerce-cart .wc-block-cart__submit-button:not(#btn-1cc),
     3458       .wp-block-woocommerce-cart .wc-block-components-checkout-button:not(#btn-1cc),
     3459       .wc-block-cart .wc-block-cart__submit-button:not(#btn-1cc),
     3460       .wc-block-cart .wc-block-components-checkout-button:not(#btn-1cc) {
     3461           display: none !important;
     3462       }
     3463       </style>
     3464       <?php
     3465    }
     3466}
     3467
    34093468//To add 1CC Mini cart checkout button
    34103469if(isRazorpayPluginEnabled() && is1ccEnabled() && isMiniCartCheckoutEnabled())
     
    34163475        remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
    34173476
    3418         add_action('woocommerce_cart_updated', 'enqueueScriptsFor1cc', 10);
    3419 
    34203477        add_action( 'woocommerce_widget_shopping_cart_buttons', 'addMiniCheckoutButton', 20 );
    34213478
     
    34253482function addMiniCheckoutButton()
    34263483{
    3427     add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);
    3428 
    34293484    if (isTestModeEnabled()) {
    34303485      $current_user = wp_get_current_user();
     
    34663521function addPdpCheckoutButton()
    34673522{
    3468     add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);
    3469 
    34703523    if (isTestModeEnabled()) {
    34713524      $current_user = wp_get_current_user();
     
    35103563{
    35113564    add_filter('woocommerce_coupons_enabled', 'disable_coupon_field_on_cart');
    3512     add_action('woocommerce_cart_updated', 'enqueueScriptsFor1cc', 10);
    35133565    add_filter('woocommerce_order_needs_shipping_address', '__return_true');
    35143566}
Note: See TracChangeset for help on using the changeset viewer.