Last active
November 7, 2021 12:41
-
-
Save kilbot/311cf30800339dd17cf063b710f9b9fe to your computer and use it in GitHub Desktop.
Support for PW Gift Cards plugin
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 | |
// add to your theme functions.php file | |
function pw_gift_card_product_response($response) { | |
if( ! function_exists('is_pos') || ! is_pos() ) | |
return $response; | |
$data = $response->get_data(); | |
$type = isset( $data['type'] ) ? $data['type'] : ''; | |
if($type == 'pw-gift-card') { | |
$data['type'] = 'variable'; | |
$response->set_data( $data ); | |
} | |
return $response; | |
} | |
add_filter( 'woocommerce_rest_prepare_product_object', 'pw_gift_card_product_response', 9, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment