It is WooCommerce default behaviour to scroll to the top of the checkout or the cart form after an errored checkout submit. I had a case where the auto scroll didn’t scroll to the right position so the errors were always hidden. The auto scroll code is located in the file woocommerce.js, here what I […]
read moreNEWS
I recently tried to use screen options for a wordpress backend plugin. I wanted to use a per page variable to be able to easily manage a number of users to request. I first init the screen options : add_action(‘my_plugin_slug’, array( $this, ‘screen_set_option’)); function screen_set_option() { add_screen_option(‘per_page’, array( ‘default’=>10, […]
read moreGet membership object from user id function get_membership($user_id) { return wc_memberships()->get_user_memberships_instance()->get_user_memberships( $user_id )[0] ??null; } Get member id from user id function get_member_id($user_id) { if (get_membership($user_id)) return get_membership($user_id)->get_id(); else return null; } Get subscription id from member id function get_subscription_id($member_id) { $subscription_id = get_post_meta( $member_id, ‘_subscription_id’, true ); return $subscription_id; } […]
read more