You can use the woocommerce_quantity_input_args
filter:
function wpse_292293_quantity_input_default( $args, $product ) {
$args['input_value'] = 2;
return $args;
}
add_filter( 'woocommerce_quantity_input_args', 'wpse_292293_quantity_input_default', 10, 2 );
When the quantity input is output, it’s output with the woocommerce_quantity_input()
function. This function accepts several arguments including the default value for the input. This filter lets you replace values in the arguments across all uses of the function.
Related Posts:
- Woocommerce – Hide a Column in Cart Table
- how to add custom functionality after woocommerce place order button
- Remove an action by extending class and replacing it
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Hide one specific woocoomerce product
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- woocommerce single product page hook not working
- Woocommerce: block user removing cart item
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Add a new tab to WordPress Plugin install Listing
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How do you use the plugin boilerplate loader class to hook actions and filters?
- Does WP fire delete_post when trashed posts are automatically deleted?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- How to add a link to WordPress Plugin install Listing
- Call activation hook multiple times
- Two-step login process – Is it possible?
- get all products of one category
- How can I hook into existing WordPress Bulk actions?
- Hook for post permalink update
- Get returned variable from a function to add_shortcode function
- Woocommerce add custom button to backend order table
- How do I hook a custom discount to change a WC_Order price total on WooCommerce?
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Synchronize Custom post type tags to WordPress default posts tags
- unable to stop loop when using wp_insert_post with publish_post hook
- Print value of an array or variable in a payment plugin
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- $wpdb -> Batch insert from XML File?
- Why my database table not created on activation?
- Where and how does WordPress store and use its plugin and hook information?
- Which are the hooks run before/after when a category’s deletion?
- edit_{$taxonomy} | Hook
- WordPress after content Hook & external template part
- best practice for query string values – get_query_var always empty for my value supplied in query string
- Custom attribute type not displaying terms in edit product – WooCommerce
- Modifying meta tags after doing ajax call in plugin
- Where to add hooks in a class
- Adding a brand column to WooCommerce Products
- How to use output buffering in WordPress hooked functions?
- Adding option to Gallery shortcode
- do_action and add_action on two different installed plugins won’t work
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- Woocommerce extend tax report with custom column
- woocommerce_checkout_order_processed hook executing function twice
- I have 2 plugins using the same wp_login action hook and one is not working
- Add a new confirmation page before saving
- How dynamic action login_form_{action} is working
- What happens when two or more plugins use the same hook?
- UWooCommerce – add cart discount programmatically?
- flush rewrite rules after plugin update?
- When does save_post hook fire on post save/update
- Plugin does not add action
- Add child pages to submenu automatically
- After plugin activation hook
- hook filter after the_content on a specific page
- Run command “composer install” when activating wordpress plugin
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- Custom Plugin Options Won’t Update
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Creating posts with links from a txt file
- How to make every image title equal to alt text(wordpress/woocommerce)?
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- Getting Post ID at “stylesheet” and “template” hooks
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Getting products information, in woocommerce based on products ID
- Is there any way to get post meta from publish_post hook?
- WC REST API Error Handling
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- How to remove the WooCommerce Product->Category thumbnail from admin [closed]
- Override WooCommerce files from plugin
- woocommerce add a new bulk action in the bulk actions dropdown in the orders list
- Plugin Development – Call to undefined function comment_exists()
- Prevent plugin activation and add admin notice
- Handle changed Woocommerce function
- Making Woocommerce optimized for more than 500k products
- Does WordPress have something like timer hook?
- Declaring a new woo commerce product type i get this error
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- How to design WooCommerce-like admin tabs for plugin settings page?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Send retrieve password notification email with custom HTML email template
- Return custom product in ajax call loop
- WooCommerce adds a newline symbol (\n) between email recipients
- Ninja Forms: Front-End Forms, Post ID?
- Allow HTML in product attributes and variation for WooCommerce
- How do I add multiple custom menu Woo-commerce my account page?
- Execute callback after REST API request completes + Response is sent
- High-Performance Order Storage conflict action `manage_shop_order_posts_custom_column`