woocommerce_product_duplicate_before_save

woocommerce_product_duplicate_before_save

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

do_action('woocommerce_product_duplicate_before_save') is found 2 times:

  • /includes/admin/class-wc-admin-duplicate-product.php line 178
    		 * This action can be used to modify the object further before it is created - it will be passed by reference.
    		 *
    		 * @since 3.0
    		 */
    		do_action( 'woocommerce_product_duplicate_before_save', $duplicate, $product );
    
    		// Save parent product.
    		$duplicate->save();
    
    		// Duplicate children of a variable product.
    		if ( ! apply_filters( 'woocommerce_duplicate_product_exclude_children', false, $product ) && $product->is_type( 'variable' ) ) {
    
  • /includes/admin/class-wc-admin-duplicate-product.php line 214
    				 * This action can be used to modify the object further before it is created - it will be passed by reference.
    				 *
    				 * @since 3.0
    				 */
    				do_action( 'woocommerce_product_duplicate_before_save', $child_duplicate, $child );
    
    				$child_duplicate->save();
    			}
    
    			// Get new object to reflect new children.
    			$duplicate = wc_get_product( $duplicate->get_id() );
    

See this hook used in plugins: