Authenticate user into wordpress via 3rd party system, both with the same domain

I found a way to do it. I created a new folder under https://domain.tld/store/ and created 2 new files (/store/integra/wp-login.php and /store/integra/wp-auth.php). wp-login.php require_once(“wp-auth.php”); auth(); wp-auth.php startit(); function auth() { // decode query string $u = base64_decode($_GET[‘u’]); $p = base64_decode($_GET[‘p’]); $r = base64_decode($_GET[‘r’]); $username = htmlspecialchars($u); $password = htmlspecialchars($p); $user = get_user_by(‘login’, $username); if (!wp_check_password($password, … Read more

How do I hide out of stock products from homepage but not from catalog?

Assuming you are using storefront default homepage template. You can filter products before displaying on hompepage function rfl_show_backorders( $is_visible, $id ) { $product = new wC_Product( $id ); if ( ! $product->is_in_stock() && ! $product->backorders_allowed() && is_front_page() ) { $is_visible = false; } return $is_visible; } add_filter( ‘woocommerce_product_is_visible’, ‘rfl_show_backorders’, 10, 2 );

Which hook should I use to capture $_POST(‘password’) via profile update and password reset

Sometimes you have to look at the name of the input you’re trying to pick up via $_POST. It’s not always consistent across forms. In the case of the WooCommerce password change form, the input name for the new password field is ‘password_1’ so that’s what you need to pick up via $_POST: function my_profile_update( … Read more

How to hide out of stock products in Related Products via custom query in WooCommerce

Figured it out. None of the blog posts out there are accurate it seems. Put this in your functions.php file. You can change the posts per page number to see if its working straight away or not. add_filter( ‘woocommerce_output_related_products_args’, function( $args ) { $args = wp_parse_args( array( ‘posts_per_page’ => 4, ‘meta_query’ => array ( ‘key’ … Read more

Display description on cart page

$_product object is product variation object. You have to first get the parent product id and then get the description of parent product. $parent_product_id =$_product->get_parent_id(); $parent_product = get_post($parent_product_id); echo $content = $parent_product->post_content; Or echo $_product->parent->description;

Filter WooCommerce Orders query with user meta data

I see 2 possible ways: 1) Using your WP_User_Query in a WC_Order_Query with the customer_id argument this way: // Users query $user_ids = (array) get_users([ ‘role’ => ‘customer’, ‘number’ => – 1, ‘fields’ => ‘ID’, ‘meta_query’ => [ ‘relation’ => ‘OR’, [ ‘key’ => ‘unsubscribed’, ‘compare’ => ‘!=’, ‘value’ => 1 ], [ ‘key’ => … Read more