You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there,
We are currently developing a site that uses tutor as an LMS but also is not the main focus of the website,
Since we have different products our minicart is bugged due to your code, the filter "woocommerce_cart_item_permalink" does not return a permalink for normal products, this is due how the callback is implemented.
tutor\classes\WooCommerce.php:748
publicfunctiontutor_update_product_url( $permalink, $cart_item ) {
$woo_product_id = $cart_item['product_id'];
$product_meta = get_post_meta( $woo_product_id );
if ( isset( $product_meta['_tutor_product'] ) && $product_meta['_tutor_product'][0] ) {
global$wpdb;
$table = $wpdb->base_prefix . 'postmeta';
$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$table} WHERE meta_key = '_tutor_course_product_id' AND meta_value = %d ", $woo_product_id ) ); //phpcs:ignoreif ( $post_id ) {
$data = get_post_permalink( $post_id );
return$data;
}
}
// Does not existreturn$permalink; // Should return the original permalink
}
As you can see, the function tries to retrieve the associated course and changes the link to the course link if it has the _tutor_product meta, but if it does not, it voids.
Please return the original permalink as I've noted in the comments in the code provided above.
Hello there,
We are currently developing a site that uses tutor as an LMS but also is not the main focus of the website,
Since we have different products our minicart is bugged due to your code, the filter "woocommerce_cart_item_permalink" does not return a permalink for normal products, this is due how the callback is implemented.
As you can see, the function tries to retrieve the associated course and changes the link to the course link if it has the _tutor_product meta, but if it does not, it voids.
Please return the original permalink as I've noted in the comments in the code provided above.
The original code:
The text was updated successfully, but these errors were encountered: