Skip to content

Instantly share code, notes, and snippets.

@kilbot
Created November 7, 2021 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilbot/74359a2803a402f4cce90fbc616dd1f1 to your computer and use it in GitHub Desktop.
Save kilbot/74359a2803a402f4cce90fbc616dd1f1 to your computer and use it in GitHub Desktop.
Support for PW Gift Cards plugin
<?php
// add to your theme functions.php file
function custom_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', 'custom_product_response', 9, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment