Checkbox field that add a subscription product and change prices of other products in checkout and cart page

I solved the my issue. this code may help others in future. // Display a custom checkout field add_action( ‘woocommerce_checkout_before_terms_and_conditions’, ‘custom_checkbox_checkout_field’ ); function custom_checkbox_checkout_field() { $value = WC()->session->get(‘add_a_product’); woocommerce_form_field( ‘cb_add_product’, array( ‘type’ => ‘checkbox’, ‘label’ => ‘  ’ . __(‘Please check here to get VIP Membership’), ‘class’ => array(‘form-row-wide’), ), $value == ‘yes’ ? true : … Read more

How to create different views for different user roles?

If you are looking for a programming solution I can follow up in the comments with examples, but I think the best “plug and play” solution would be an existing solution like Learndash(https://www.learndash.com/) or Sensei (https://woocommerce.com/products/sensei/). These have different roles, quizzes with grading, and other features that you may find useful. Here are some additional … Read more

Modify function output in a plugin

You haven’t created your filter yet. You can’t just filter a function. You’ll need to call the function apply_filters(), and then you can use it in your functions.php file. So above return $content; add something like this: $content = apply_filters( ‘my_content_filter_name’, $new_content, $content ); Then, use it like this: function modify_store_output( $content ) { $content … Read more