Created
November 11, 2024 06:15
-
-
Save webtoffee-git/a828aef70abcbee5fc7211b1394fe73e to your computer and use it in GitHub Desktop.
Code snippet to alter product image URL in documents - by WebToffee ( WooCommerce PDF Invoice, Packing Slips, Delivery Notes and Shipping labels (free)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Do not copy this line of code | |
add_filter('wt_pklist_alter_product_image_url', 'wt_pklist_alter_product_image_url_fn', 10, 4); | |
/** | |
* Filter to customize the product image URL in packing lists. | |
* | |
* This function allows you to set a custom image URL for a product. | |
* If a custom image URL is available, update the `$img_url` variable to use that URL. | |
* @return string The updated image URL to be used in the packing list. | |
*/ | |
function wt_pklist_alter_product_image_url_fn($img_url, $product_id, $variation_id, $parent_id) { | |
// Retrieve your custom image URL here (if needed) | |
$img_url = 'http://backend-test.local/wp-content/uploads/2024/08/images-1.jpeg'; | |
return $img_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment