// Display sku in cart
add_filter( ‘woocommerce_get_item_data’, ‘func_js_display_custom_item_data_in_cart’, 100, 2 );
function func_js_display_custom_item_data_in_cart( $cart_item_data, $cart_item )
{
$cart_item_data[] = array(
‘name’ => __( ‘SKU ‘, ‘woocommerce’ ),
‘value’ => ” . $cart_item[‘data’]->get_sku() . ‘ ‘,
);
return $cart_item_data;
}
add_action( ‘wp_footer’, ‘cart_update_qty_script’ );
function cart_update_qty_script() {
if (is_cart()) :
?>
var $ = jQuery;
$(‘div.woocommerce’).on(‘change’, ‘.product-quantity .quantity input[id^=”quantity”]’, function()
{
var qty = $(this).val();
var sku = $(this).closest('tr.cart_item').find('.product_sku').html();
alert("Your have changed the quantity of " + sku + " to " + qty + ".");
$("[name="update_cart"]").prop("disabled", false);
$("[name="update_cart"]").trigger("click");
});
</script>
<?php
endif;
}
Related Posts:
- Use wc_enqueue_js only on specific pages – nested add_action
- woocommerce subscriptions – get expiration date [closed]
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to auto fetch customer details in Woocommerce in checkout page
- I want to add custom add to cart link [closed]
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Change product_base programmatically
- Can a plugin redirect product page based on IF condition?
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- custom post type with role Vendor
- Woocommerce custom Plugin in wordpress [closed]
- Add a custom WooCommerce settings tab with sections
- Payment field disappears on custom Paypal plugin
- I am having errors with checkout on wordpress
- product_type_options get saved value [closed]
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Looping through and combining calls to Woocommerce REST API
- How to import woocommerce custom fields data into another site?
- How do I remove an action hook inside a class that is called by another class?
- How keep woocommerce users separeted in multisite install and keep admins on network
- Custom field fetch error on woocommerce pdf invoice
- Woocommerce Convert existing order to the cart
- How to change product SKU’s in bulk with a plugin
- error_log() output for print_r() appearing on page
- Allow only 1 taxonomy per custom post type [duplicate]
- Remove Woocommerce product link
- Retrieve multiple values passed to a single attribute in a shortcode
- How to change date language without changing the entire site language?
- Using Cookie Data For WP_Query Loop
- OOP Plugin Development. Including external object
- Authenticating to WordPress, using my own authentication two-factor system
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Create table in database when activating plugin
- Problem with WordPress Ajax form
- allow user to select pages from dropdown in my plugin
- Using Font Awesome as post thumbnail
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- admin-ajax.php responding with 0
- How to prevent those PHP variables from being cached on WordPress?
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- WordPress php filter admin_body_class not working
- Same log message keeps on printing to debug.log file thousand of times
- Append HTML Using Shortcode
- Create onClick Event to Re-load a Widget
- Modify HTML structure of fields in woocommerce checkout form
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Reprinting tags with all attributes
- Update results, Before deleting the related category [closed]
- How can I get the values of my WordPress $wpdb query in Jquery?
- Trouble checking if custom woocommerce checkout field is empty or not
- Adding function to Genesis genesis_header [closed]
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Asynchronous multiple requests 401 Unauthorized
- Using data sent via AJAX in multiple functions on a WP plugin
- What does -> mean in WordPress?
- How to add the sidebar to all the pages except the home page? [closed]
- How to optimize update_post_meta?
- customize woocommerce templates and display store on home
- Plugin development and composer
- WC_Customer delete function returns error
- CSS change in woo commerce Place Order Text [closed]
- Woocommerce: remove total sum from new order’s email [closed]
- Set default Database Storage Engine when creating tables with plugins?
- WooCommerce: Display product categories to make IF statement
- Execute Jquery when a specific page in my plugin is loading
- Modify WooCommerce used to get all orders in dashboard
- Add Custom Category Description When Empty
- I am having issue in divi woocomerce checkout module. (DIVI theme)
- Add a product category to a specific product via a button
- WordPress can’t use ZipArchive
- Display div if category has a specific parent
- Only the first image uploads
- global $product is empty string when passed into function
- WordPress loading progess – wp-blog-header.php
- Illegal string offset checkbox
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Trying to use a variable to set image width
- wp_update_post gives 500 internal error
- Don’t update modified post date when user add a product review or comment?
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- get_filtered_term_product_counts – Get product terms if any products
- register_setting not save checkbox
- How does one make a URL return dynamic JSON with custom Content Type?
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Add Product Permalink in woocommerce admin order page
- How to give custom roles the capability to edit one Menu instead of every Menu
- WooCommerce Custom Tab with ACF Repeater Field
- add menu page in loop menu order
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- How to remove image on single product and get product to span page?
- Custom post type single page return to listing page
- WordPress rewrite question
- Using Nonce for my Form
- Create new folder and upload files to custom folder via wp_handle_upload
- Unable to show 4 products in a row
- Getting custom field data from cart page to checkout page in woocomerce [closed]