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.8.1

do_action('woocommerce_product_duplicate_before_save') is found 2 times:

  • /includes/admin/class-wc-admin-duplicate-product.php line 181
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    * 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.
  • /includes/admin/class-wc-admin-duplicate-product.php line 221
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
         * 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: