Changeset 2469416
- Timestamp:
- 02/05/2021 10:38:04 AM (5 years ago)
- Location:
- miqid-woo/trunk
- Files:
-
- 3 edited
-
miqid-woo.php (modified) (1 diff)
-
readme.md (modified) (1 diff)
-
src/Frontend/Conditional_Shipping.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
miqid-woo/trunk/miqid-woo.php
r2469411 r2469416 3 3 * Plugin Name: MIQID-Woo 4 4 * Description: MIQID-Woo extension for WooCommerce. 5 * Version: 1.1. 05 * Version: 1.1.1 6 6 * Requires at least: 5.2 7 7 * Requires PHP: 7.2 -
miqid-woo/trunk/readme.md
r2469411 r2469416 4 4 Tested up to: 5.5.3 5 5 Requires PHP: 7.2 6 Stable tag: 1.1. 06 Stable tag: 1.1.1 7 7 License: GPL v3 or Later 8 8 -
miqid-woo/trunk/src/Frontend/Conditional_Shipping.php
r2469411 r2469416 20 20 21 21 private function __construct() { 22 add_filter( 'woocommerce_before_cart', [ $this, 'clear_wc_shipping_rates_cache' ]);23 add_filter( 'woocommerce_before_checkout_form', [ $this, 'clear_wc_shipping_rates_cache' ]);22 add_filter( 'woocommerce_before_cart', [ $this, 'clear_wc_shipping_rates_cache' ] ); 23 add_filter( 'woocommerce_before_checkout_form', [ $this, 'clear_wc_shipping_rates_cache' ] ); 24 24 add_filter( 'woocommerce_package_rates', [ $this, '_rates' ] ); 25 25 add_shortcode( 'miqid_woo_club_signup', [ $this, '_customer_club_signup' ] ); … … 31 31 32 32 33 function clear_wc_shipping_rates_cache() {33 function clear_wc_shipping_rates_cache() { 34 34 $packages = WC()->cart->get_shipping_packages(); 35 35 36 foreach ( $packages as $key => $value) {36 foreach ( $packages as $key => $value ) { 37 37 $shipping_session = "shipping_for_package_$key"; 38 38 39 unset( WC()->session->$shipping_session);39 unset( WC()->session->$shipping_session ); 40 40 } 41 41 } 42 42 43 43 function _rates( $rates ) { 44 $user = wp_get_current_user();44 $user = wp_get_current_user(); 45 45 $Conditional_Shipping = []; 46 46 … … 71 71 72 72 $rate->set_cost( sprintf( '%s', $cost ) ); 73 $rate->set_label( trim( sprintf( '%s - %s',73 $rate->set_label( trim( sprintf( '%s - %s', 74 74 $rate->get_label(), 75 75 $Conditional_Shipping['label'] … … 96 96 $html[] = sprintf( '<p>%s</p>', __( 'Tilmelder du dig kundeklubben, får du samtidig besked om nye produkter samt tips og tricks før andre. Du får derudover fri fragt på alle ordrer.' ) ); 97 97 $html[] = '<div style="display: flex">'; 98 $html[] = sprintf( '<input type="email" name="miqid_woo_club_signup" placeholder="%s" value="%s" />', __( 'Skriv din email her' ), esc_attr( $user->user_email ) );98 $html[] = sprintf( '<input type="email" name="miqid_woo_club_signup" placeholder="%s" value="%s" />', __( 'Skriv din email her' ), esc_attr( $user->user_email ) ); 99 99 $html[] = sprintf( '<button type="button" style="white-space: nowrap">%s</button>', __( 'Signup' ) ); 100 100 $html[] = '</div>'; … … 118 118 $user_id = wp_create_user( $email, wp_generate_password(), $email ); 119 119 if ( ! is_wp_error( $user_id ) ) { 120 $user = new \WP_User( $user_id ); 121 } 122 if ( ! is_user_logged_in() ) { 123 wp_set_current_user( $user->ID ); 124 wp_set_auth_cookie( $user->ID ); 120 $user = get_user_by( 'id', $user_id ); 125 121 } 126 122 }
Note: See TracChangeset
for help on using the changeset viewer.