Malin / user-email-in-header.php
0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 2 years ago
| 1 | /* START Display user email in header */ |
| 2 | function show_user_email_shortcode() { |
| 3 | if ( is_user_logged_in() ) { |
| 4 | $current_user = wp_get_current_user(); |
| 5 | return $current_user->user_email; |
| 6 | } else { |
| 7 | return ''; // Return an empty string if the user is not logged in |
| 8 | } |
| 9 | } |
| 10 | add_shortcode('show_user_email', 'show_user_email_shortcode'); |
Malin / brand-above-title-in-cart.php
0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 2 years ago
| 1 | /* START Display Brand above title in cart */ |
| 2 | // Function to display child category above product title on cart page |
| 3 | function display_child_category_above_product_title_on_cart( $item_name, $cart_item, $cart_item_key ) { |
| 4 | // We attempt to check if $cart_item contains product details |
| 5 | if ( isset( $cart_item['product_id'] ) ) { |
| 6 | $product_id = $cart_item['product_id']; |
| 7 | |
| 8 | // Get child categories of the product |
| 9 | $product_categories = get_the_terms( $product_id, 'product_cat' ); |
Malin / unique-product-count-in-cart.php
0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 2 years ago
| 1 | /* START Unique product count in cart */ |
| 2 | // Shortcode to display the number of unique products in the cart with styling |
| 3 | function display_unique_cart_product_count_styled() { |
| 4 | // Initialize an empty array to store unique product IDs |
| 5 | $unique_product_ids = array(); |
| 6 | |
| 7 | // Get the cart contents |
| 8 | $cart_contents = WC()->cart->get_cart(); |
| 9 | |
| 10 | // Loop through each item in the cart |
Malin / custom-add-to-cart-button.php
0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 2 years ago
| 1 | /* START custom add to cart button on home */ |
| 2 | function custom_add_to_cart_button_with_icon() { |
| 3 | // Remove the default add to cart button |
| 4 | remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10); |
| 5 | |
| 6 | // Add the new custom button |
| 7 | add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart_with_icon', 10); |
| 8 | } |
| 9 | |
| 10 | function woocommerce_template_loop_add_to_cart_with_icon() { |