Closed melek closed 2 years ago
Additionally, this seems related somewhat to issue #12 (though that looks like it was about Variable Products rather than Subscriptions).
I face the same issue, the custom 'from price' is being reset on product save (variable subscription product type). Can someone please have a look into this?
Appreciate it a lot!
Or @melek : did you find a way to workaround this issue?
@bernattorras : could you perhaps have a look into this issue? Would be very appreciate it.
@bernattorras : We have the same issue. Please, can you fix it?
Unfortunately this issue is happening for us too. On our Variable Subscription page the 'Custom from string' tab is visible and you can input this field, but when publishing/updating the page it vanishes and defaults back to the unwanted standard text. A fix for this would be great please!
Same problem here - is there a resolution?
Same problem here - update the field does not save properly.
Another report in 32581901-hc
Hi , I have managed to fix it. You have to change the code though:
On the woocommerce-subscriptions-custom-pricestring. php there is a function, you have to change the order there:
/**
* Save the custom price string in the current product's '_custom_price_string' meta
*
* @access public
* @param mixed $post_id
* @return void
*/
function save_custom_price_string( $post_id ) {
if ( isset( $_REQUEST['_custom_price_string'] ) ) {
// If it is coming from a variable subscription product, skip it (as we already use the woocommerce_save_product_variation hook for this purpose).
if ( is_array( $_REQUEST['_custom_price_string'] ) ) {
return;
}
$custom_price_string = wp_unslash( $_REQUEST['_custom_price_string'] );
update_post_meta( $post_id, '_custom_price_string', $custom_price_string );
}
if ( isset( $_REQUEST['_custom_from_string'] ) ) {
$custom_from_string = wp_unslash( $_REQUEST['_custom_from_string'] );
update_post_meta( $post_id, '_custom_from_string', $custom_from_string );
}
}
add_action( 'save_post', 'save_custom_price_string', 11 );
To BECOME:
/**
* Save the custom price string in the current product's '_custom_price_string' meta
*
* @access public
* @param mixed $post_id
* @return void
*/
function save_custom_price_string( $post_id ) {
if ( isset( $_REQUEST['_custom_from_string'] ) ) {
$custom_from_string = wp_unslash( $_REQUEST['_custom_from_string'] );
update_post_meta( $post_id, '_custom_from_string', $custom_from_string );
}
if ( isset( $_REQUEST['_custom_price_string'] ) ) {
// If it is coming from a variable subscription product, skip it (as we already use the woocommerce_save_product_variation hook for this purpose).
if ( is_array( $_REQUEST['_custom_price_string'] ) ) {
return;
}
$custom_price_string = wp_unslash( $_REQUEST['_custom_price_string'] );
update_post_meta( $post_id, '_custom_price_string', $custom_price_string );
}
}
add_action( 'save_post', 'save_custom_price_string', 11 );
@bernattorras how could we update this? or you will do it?
Is this going to be updated in the next update?
Another report in 4554924-zen
Sorry for the delay! I've updated the plugin with a fix that should prevent this conflict!
Please reopen the issue if the problem persits!
i added this fix to my site. although the input box appears on all variable products types, it only displays the text added on those with Variable Subscriptions. it would be nice if it worked with other variations and simple products as well.
@fontaholic I like that idea; I think that opening a new issue would be the best way to suggest it, so it can be tracked separately.
Describe the issue Setting a custom 'From' price string on a variable subscription doesn't work - saving it results in the field being blank upon reload, and the from price isn't customized on the front-end. The custom price strings per-variation work just fine.
Steps to replicate On WordPress 5.7.2 with only Storefront, WooCommerce, Subscriptions, and Subs Custom Price String active and up to date:
What should happen instead The custom price string should be saved and displayed as expected.
Additional Information