Changeset 3350444
- Timestamp:
- 08/26/2025 01:02:59 PM (6 months ago)
- Location:
- woo-razorpay/trunk
- Files:
-
- 1 added
- 2 edited
-
public/js/cart-block-1cc.js (added)
-
readme.txt (modified) (2 diffs)
-
woo-razorpay.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-razorpay/trunk/readme.txt
r3331331 r3350444 4 4 Requires at least: 3.9.2 5 5 Tested up to: 6.8 6 Stable tag: 4.7. 66 Stable tag: 4.7.7 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 69 69 70 70 == 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. 71 76 72 77 = 4.7.6 = -
woo-razorpay/trunk/woo-razorpay.php
r3331331 r3350444 4 4 * Plugin URI: https://razorpay.com 5 5 * 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. 67 * Stable tag: 4.7. 66 * Version: 4.7.7 7 * Stable tag: 4.7.7 8 8 * Author: Team Razorpay 9 * WC tested up to: 9.1.29 * WC tested up to: 10.1.1 10 10 * Author URI: https://razorpay.com 11 11 */ … … 2714 2714 rzpLogInfo("updateOrderAddress function executed"); 2715 2715 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 2716 2729 $order->save(); 2717 2730 } … … 3361 3374 wp_register_script('1cc_razorpay_checkout', RZP_CHECKOUTJS_URL, null, null); 3362 3375 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);3365 3376 3366 3377 wp_register_script('btn_1cc_checkout', BTN_CHECKOUTJS_URL, null, null); … … 3376 3387 } 3377 3388 3389 // Enqueue scripts for cart block 1CC 3390 function 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 3378 3399 //To add 1CC button on cart page. 3379 3400 add_action( 'woocommerce_proceed_to_checkout', 'addCheckoutButton'); … … 3382 3403 add_action('wp_head', 'injectMerchantKeyMeta', 1); 3383 3404 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 3410 function 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); 3384 3418 } 3385 3419 3386 3420 function addCheckoutButton() 3387 3421 { 3388 add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);3389 3390 3422 if (isRazorpayPluginEnabled() && is1ccEnabled() ) 3391 3423 { … … 3407 3439 } 3408 3440 3441 // Adds Magic Checkout button on WooCommerce Cart Block pages 3442 function 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 3409 3468 //To add 1CC Mini cart checkout button 3410 3469 if(isRazorpayPluginEnabled() && is1ccEnabled() && isMiniCartCheckoutEnabled()) … … 3416 3475 remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 ); 3417 3476 3418 add_action('woocommerce_cart_updated', 'enqueueScriptsFor1cc', 10);3419 3420 3477 add_action( 'woocommerce_widget_shopping_cart_buttons', 'addMiniCheckoutButton', 20 ); 3421 3478 … … 3425 3482 function addMiniCheckoutButton() 3426 3483 { 3427 add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);3428 3429 3484 if (isTestModeEnabled()) { 3430 3485 $current_user = wp_get_current_user(); … … 3466 3521 function addPdpCheckoutButton() 3467 3522 { 3468 add_action('wp_enqueue_scripts', 'enqueueScriptsFor1cc', 0);3469 3470 3523 if (isTestModeEnabled()) { 3471 3524 $current_user = wp_get_current_user(); … … 3510 3563 { 3511 3564 add_filter('woocommerce_coupons_enabled', 'disable_coupon_field_on_cart'); 3512 add_action('woocommerce_cart_updated', 'enqueueScriptsFor1cc', 10);3513 3565 add_filter('woocommerce_order_needs_shipping_address', '__return_true'); 3514 3566 }
Note: See TracChangeset
for help on using the changeset viewer.