add_action( 'before_delete_post', 'delete_post_or_product_media', 10, 1 ); function delete_post_or_product_media( $post_id ) { // Check if the post is a WooCommerce product if ( 'product' === get_post_type( $post_id ) ) { $product = wc_get_product( $post_id ); if ( !$product ) { return; } // Get product featured image and gallery images $featured_image_id = $product->get_image_id(); $gallery_image_ids = $product->get_gallery_image_ids(); // Delete featured image if ( !empty( $featured_image_id ) ) { wp_delete_attachment( intval( $featured_image_id ), true ); } // Delete gallery images if ( !empty( $gallery_image_ids ) ) { foreach ( $gallery_image_ids as $image_id ) { wp_delete_attachment( intval( $image_id ), true ); } } } // Get all media attached to the post (non-product) $attached_media = get_attached_media( '', $post_id ); if ( !empty( $attached_media ) ) { foreach ( $attached_media as $media ) { // Make sure $media->ID is properly escaped and cast to an integer $attachment_id = intval( $media->ID ); if ( $attachment_id ) { wp_delete_attachment( $attachment_id, true ); } } } }

Oklahoma State Cowboys | NCAA Pattern Baseball Jacket, Varsity Jacket V12

$54.95

Oklahoma State Cowboys | NCAA Pattern Baseball Jacket, Varsity Jacket V12

$54.95

  • $0.00
Quantity

Frequently Bought Together:

Description

Product information:

Material: 95% polyester and 5% spandex fabric

Size: S – 5XL

Due to the manual measurement, please allow 1-2 cm of tolerance

Due to variations in light and color settings of computer/personal device screens, colors may appear slightly different from photographic images.

Production: 6-8 business days

Shipping time:

  • Shipments within the USA take 7 – 15 days. Typically, it takes 14-28 business days to arrive at an international address. This time is when it is shipped out, not when the order is placed. Due to Covid-19, it maybe takes 2-6 business additional days.
  • Worldwide shipping is available. Shipping fees and delivery time depend on the country and total weight of items in your order.

Product information:

Material: 95% polyester and 5% spandex fabric

Size: S – 5XL

Due to the manual measurement, please allow 1-2 cm of tolerance

Due to variations in light and color settings of computer/personal device screens, colors may appear slightly different from photographic images.

Production: 6-8 business days

Shipping time:

  • Shipments within the USA take 7 – 15 days. Typically, it takes 14-28 business days to arrive at an international address. This time is when it is shipped out, not when the order is placed. Due to Covid-19, it maybe takes 2-6 business additional days.
  • Worldwide shipping is available. Shipping fees and delivery time depend on the country and total weight of items in your order.
×
×