// 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
- Woocommerce Payment Method Change
- combine Code 1 with Code 2
- WooCommerce – Reset quantity input field when variation changes
- WP nonce invalid
- get current product name in functions.php
- Get stock by custom meta field on all Woocommerce variable products
- Make the first item as default on Woocommerce product category items list
- Custom Text in WooCommerce Order Processing Email Based on Products
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- Set a condition based on WooCommerce checkout city field while placing order
- Get WooCommerce product details and transfer them to a custom DB table
- Same log message keeps on printing to debug.log file thousand of times
- tracking number field in Woocommerce order [closed]
- WooCommerce Related Products by Attribute
- Adding Default Settings to Theme My Login plugin
- Image as Sales Badge
- Custom filter in admin edit custom post type responding with invalid post type?
- WordPress Scheduled Event Request Blocking
- How can i upload images in an admin page?
- Append HTML Using Shortcode
- Delete a WordPress transient from a shortcode on Page/Post update
- WooCommerce – Email admin with new user details
- Plugin CSS not enqueing
- Create onClick Event to Re-load a Widget
- Swapping wp_dropdown_categories function with wp_category_checklist
- Automatically remove a canceled order in Woocommerce
- Accessing the database from a plugin outside of action hooks
- Adding subdomain to home_url for “add_menu_page”
- How to show phpinfo() only in a new tab?
- How to find error in my code when the error message is pointing to WP core file?
- How to select the contents in the text view textrea in wp_editor?
- Call global variable array() in woocommerce child/template
- Remove price from Woocommerce variable product dropdown menu
- How to access global variable $menu inside a class function
- Adding nofollow to a PHP generated Nav
- Hide categories that are not used in the post type
- How can I remove a function that has been added to wordpress with add_filter?
- Two Different Links for Same Product – WooCommerce [closed]
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- Issue adding sub category programmatically
- How to sanitize any integer input field in wordpress?
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- dividing sub-categories by parent category – WordPress
- Show prices with tax in Woocommerce Mini Cart [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Custom user login page by creating a plugin
- Woocommerce product variation backorder
- Status 400 for AJAX POST Request with admin-ajax.php
- Singelton class does not work, multiple initialization on page reload
- Problem with custom plugin using AJAX to pull info from php file
- Saving an array of dynamic repeater data as post_meta
- Woocommerce hook run after an Order been created through REST API
- How can I apply_filters from inside a function?
- Get and insert order email address to the PHP template inside HTML text
- what is the best practice to add new field to an api route
- filter default query to show just selected level of child pages in wordpress
- Modify HTML structure of fields in woocommerce checkout form
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- How to upload a file to a folder named after the user_id via plugin
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Auto-update products after they were published – Woocommerce
- Reprinting tags with all attributes
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Reload part of checkout on changed shipping method
- How to get all shipping rates and costs without session in woocommerce?
- Display a specific category of products in shop page and disable code for specific actions
- If no products are on sale – hide ID or class
- Woocommerce related product text
- Woocommerce api: create product with images – bad request
- Trying to build simple deposit code that hooks into woocommerce
- WooCommerce Webhooks not firing because of error in wp-includes/meta.php
- Different Minimum Order Amounts based on Shipping Zone [closed]
- Use custom post type for a store locator
- developing a wordpress plugin, have a few PHP Woocommerce related coding questions
- do search in two site and show the result in first site