arie_cristianD

Auto add Jeg Font Preview Data to all product on sale

Jul 11th, 2025
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1.  
  2. add_filter( 'admin_init', 'auto_add_jeg_font_preview' );
  3.  
  4. /**
  5.  * Auto add Jeg Font Preview Data to all product on sale.
  6.  */
  7. function auto_add_jeg_font_preview() {
  8.  
  9.     // Get FONT data from product ID.
  10.     $custom_meta = get_post_meta( 165, 'jfp-woocommerce-settings', true ); /* change 165 with your product ID */
  11.  
  12.     // Get All product on sale.
  13.     $sale_products = wc_get_product_ids_on_sale();
  14.  
  15.     /**
  16.      * Add Font data to all sale product.
  17.      */
  18.     foreach ( $sale_products as $product_id ) {
  19.         update_post_meta( $product_id, 'jfp-woocommerce-settings', $custom_meta );
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment