Skip Navigation

[Resolved] Using CRED to create a WooCommerce Featured Product management form

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1228801

Hello,

I would like to create a very simple page for my website editors to access, so they can control which products are set to featured on a regular basis. I can't seem to find these options. Please let me know if this is possible.

Thanks!

I did find an old support post that mentions this function:

add_action('cred_save_data','func_set_featured_product',10,2);
function func_set_featured_product($post_id,$form_data) {

if ($form_data['id']==9999) {

$terms = array( 'featured' );
wp_set_object_terms( $post_id, $terms, 'product_visibility' );

}
}

#1228821

Yes, that's still essentially how featured product status works. Featured status is set by the "featured" term in the "product_visibility" taxonomy. Add the term and the product is featured. Remove the term and the product is no longer featured. It's not a public taxonomy, so you won't find inputs to manage it in Forms. You'll have to create your own Form that edits products, and add this code to set the featured status when the Form is submitted. The Form should only have one visible input: the submit button. Then you'll create another Form that edits products, and add similar code to remove the featured term.
https://codex.wordpress.org/Function_Reference/wp_set_object_terms