// 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
- When to use Exceptions vs Error Objects vs just plain false/null
- Woocommerce get selected shipping zone id for the current user
- WordPress URL Rewrite not working
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- simple wordpress ajax plugin not working when not logged in
- How to show order data by multiple ID?
- how to create and show sessions in word press?
- Problem with Woocommerce REST API Authentication
- New Plugin Review
- Create custom blocks for bootstrap
- Woocommerce HTML email option unavailable
- How to add SVG icon above product tab title
- How to change / delete product short description in Woocommerce
- How to trash multiple post/product programmatically
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- OrderItem get_total() returns lower value than $order_item->get_product()->get_price() * quantity
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- WooCommerce – Reset quantity input field when variation changes
- Custom Text in WooCommerce Order Processing Email Based on Products
- WordPress Scheduled Event Request Blocking
- Woocommerce hook run after an Order been created through REST API
- How to call plugin function per site in a multisite?
- Options API get_option() and update_option() Not Correctly Updating or Returning
- WooCommerce custom product dimensions
- wp_head function not outputting
- How to make own crop image function for WordPress plugin
- WordPress Woocommerce – Product Type [closed]
- Pagination for custom shop loop woocommerce
- get_total () returns 0 – woocommerce [closed]
- wp_insert_post: array only. wp_update_post: array|object (?)
- Building a REST API for your web app exposes primary keys of DB records?
- How to rename woocommerce-billing-fields
- Create a package of products as one Item in woocommerce?
- fetch woocommerce product with custom taxonomy
- Custom Registration username_exists / email_exists
- Action Hook Inside WordPress Plugin Shortcode
- After disabling WPML multi currency, the currency is still handled by the WPML
- Submit form to db
- How can i programmatically change the SKU of a product based on product variation?
- Execute PHP code only with specific user role
- Checking page before applying image restrictions while uploading
- PHP function for horizontal Woocommerce thumbnails and badges
- WooCommerce display price before add to cart [closed]
- Get the same SKU from woocommerce itself for simple and variable products
- Drop down question
- Woocommerce checkout page – custom field checkbox value into email
- custom mailchimp form using HTTP API
- How to override theme’s public static function inside of a trait?
- pass datetime using wp_localize_script to frontend from settings page
- add custom metabox to media library custom widget
- Enqueue sripts and styles only if function is called
- Add widget area from visual editor
- Register/enqueue scripts only on certain admin pages
- Looping through custom data in a custom table to display all items in a post
- Make WooCommerce product categories only show images on homepage
- ACF under category name in shop page [closed]
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- WP_Query To Display Product Of Brand On Taxonomy Page
- WooCommerce subcategories help
- Woocommerce list variations that are added already to cart in Single Product
- WooCommerce multiple custom fields code
- not able to access $_POST on backend profile update
- Custom Plugin Develoment, Form Action
- WordPress Query Crashes Browser
- How to have more than one ID included in the exclude command?
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Plugin Modification Change Functionality For Logged User Only
- WordPress using get_term to retreive slug not working as expected
- Can’t make product images clickable
- add shortcode heading showing multiple time
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- Order woo products, but first products must be with acf fields
- using a shortcode in a hyperlink
- Show button in header when product custom field is not empty
- How to change shipping method title based on cart amount?
- Redirect posts to post editor page based on query string
- How to add SKU and remove product title from WooCommerce url?