'changing the display location of custom product field on a variable product page
i added a custom field to a variable product and displayed it on the front single product page with the help of an answer here
https://stackoverflow.com/a/55774613/14382875
by default the custom field is displayed on the front page above the add to cart button. but i want to move the custom field from there to right above the product meta data or the sku field in variable product. i was able to do this in simple product via hooks but the variable product code doesn't seem to be using any hook or i am missing something.
the code i used to display the variable product on front is this
function vp_variation_display_commodity_code( $data, $product, $variation ) {
if( $value = $variation->get_meta( 'jk_mpn' ) ) {
$data['price_html'] .= '<p class="vp-ccode"><strong>' . __("Manifacturer Part #", "woocommerce") .
': </strong>'.esc_html( $value ).'</small></p>';
}
return $data;
}```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|