Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter sguha007

    (@sguha007)

    Hello,

    Yes I am trying to load the checkout dynamically.

    There is one page where I listed the products. When I click on the button Buy now, jQuery ajax will call with the post value product id, and quantity.

    Then the above function will call in function.php

    If there is no error then the checkout form will load on that page itself but from today when I click on the buy now button, the above error is showing.

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Thank you for your response. Here is my code

    add_action( 'wp_ajax_getCheckoutPageContent', 'getCheckoutPageContentCallBack' );
    add_action( 'wp_ajax_nopriv_getCheckoutPageContent', 'getCheckoutPageContentCallBack' );
    	function getCheckoutPageContentCallBack() {
            $product_id        = absint( $_POST['product_id'] );
            $quantity          = absint( $_POST['quantity'] );
            $product_status    = get_post_status( $product_id );
            $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
            if ( $passed_validation && WC()->cart->add_to_cart( $product_id, $quantity ) && 'publish' === $product_status ) {
    			do_action( 'woocommerce_ajax_added_to_cart', $product_id );
                global $woocommerce;
                $items = $woocommerce->cart->get_cart();
                wc_setcookie( 'woocommerce_items_in_cart', count( $items ) );
                wc_setcookie( 'woocommerce_cart_hash', md5( json_encode( $items ) ) );
                do_action( 'woocommerce_set_cart_cookies', true );
                define( 'WOOCOMMERCE_CHECKOUT', true );
                echo do_shortcode('[woocommerce_checkout]');
            } 
            die();
        }
    Thread Starter sguha007

    (@sguha007)

    Thank you for your response. But this is not my query. My query is – the employees of the same department cannot take leave on the same day? Is it possible

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Can you please inform me how can I do this – “when free shipping products in cart + regular products – only FedEx Live Rates available.”

    Thread Starter sguha007

    (@sguha007)

    Hello,

    If I understand you correctly, you want to achieve the following scenario:
    
    only free shipping products in cart – only Free shipping method available;
    regular products – only FedEx Live Rates available;
    free shipping products in cart + regular products – only FedEx Live Rates available;
    Is this correct?

    — YES absolutely.

    How can I achieve this

    Thread Starter sguha007

    (@sguha007)

    Thank you for your response. But in my case free shipping product weight and dimensions all empty(because of free shipping). So when I add free shipping product as well as with shipping charge product in the cart FedEx rates not coming.

    I want the FedEx rate coming only for that product which have no free shipping. It can be possible.

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Thank you for the information.

    I have one query that when I checked the shortcode I didn’t find the registration shortcode. Can you please inform me how can I enable “Sign Up with LinkedIn” functionality?

    Thread Starter sguha007

    (@sguha007)

    Then why this $wp_query->query_vars not return 380 posts

    Thread Starter sguha007

    (@sguha007)

    Yes there is filtering parameter

    if (
    !$hits[1] &&
    isset( $wp_query->query_vars[‘post_type’]) ||
    isset( $wp_query->query_vars[‘credentials’]) ||
    isset( $wp_query->query_vars[‘zipcode’])
    )

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Yes I have already done this

    $args = array(‘post_type’ => ‘vendors’,’posts_per_page’ => -1);
    $hits[0] = get_posts($args);

    when I use this, it return all 380 posts but filtering not working

    Thread Starter sguha007

    (@sguha007)

    Hetllo,

    I didn’t understand. I have already added this

    $wp_query->set( ‘posts_per_page’, -1 );

    Here:

    function rlv_hits_filter($hits) {
    global $wp_query;
    if (
    !$hits[1] &&
    isset( $wp_query->query_vars[‘post_type’]) ||
    isset( $wp_query->query_vars[‘credentials’]) ||
    isset( $wp_query->query_vars[‘zipcode’])
    ) {
    $wp_query->set(‘nopaging’, true);
    $wp_query->query_vars[‘posts_per_page’] = -1;
    }
    return $hits;
    }
    add_filter(‘relevanssi_hits_filter’, ‘rlv_hits_filter’,1);

    Thread Starter sguha007

    (@sguha007)

    Hello,

    I have remove this

    $wp_query->set(‘post_type’, $wp_query->query_vars[‘post_type’]);

    Here is the $wp_query result

    WP_Query Object
    (
    [query] => Array
    (
    [s] =>
    [post_type] => vendors
    )

    [query_vars] => Array
    (
    [s] =>
    [post_type] => vendors
    [error] =>
    [m] =>
    [p] => 0
    [post_parent] =>
    [subpost] =>
    [subpost_id] =>
    [attachment] =>
    [attachment_id] => 0
    [name] =>
    [pagename] =>
    [page_id] => 0
    [second] =>
    [minute] =>
    [hour] =>
    [day] => 0
    [monthnum] => 0
    [year] => 0
    [w] => 0
    [category_name] =>
    [tag] =>
    [cat] =>
    [tag_id] =>
    [author] =>
    [author_name] =>
    [feed] =>
    [tb] =>
    [paged] => 0
    [meta_key] =>
    [meta_value] =>
    [preview] =>
    [sentence] =>
    [title] =>
    [fields] =>
    [menu_order] =>
    [embed] =>
    [category__in] => Array
    (
    )

    [category__not_in] => Array
    (
    )

    [category__and] => Array
    (
    )

    [post__in] => Array
    (
    )

    [post__not_in] => Array
    (
    )

    [post_name__in] => Array
    (
    )

    [tag__in] => Array
    (
    )

    [tag__not_in] => Array
    (
    )

    [tag__and] => Array
    (
    )

    [tag_slug__in] => Array
    (
    )

    [tag_slug__and] => Array
    (
    )

    [post_parent__in] => Array
    (
    )

    [post_parent__not_in] => Array
    (
    )

    [author__in] => Array
    (
    )

    [author__not_in] => Array
    (
    )

    [posts_per_page] => 15
    [ignore_sticky_posts] =>
    [suppress_filters] =>
    [cache_results] => 1
    [update_post_term_cache] => 1
    [lazy_load_term_meta] => 1
    [update_post_meta_cache] => 1
    [nopaging] =>
    [comments_per_page] => 50
    [no_found_rows] =>
    [order] => DESC
    [operator] => OR
    )

    [tax_query] => Array
    (
    )

    [meta_query] => WP_Meta_Query Object
    (
    [queries] => Array
    (
    )

    [relation] =>
    [meta_table] =>
    [meta_id_column] =>
    [primary_table] =>
    [primary_id_column] =>
    [table_aliases:protected] => Array
    (
    )

    [clauses:protected] => Array
    (
    )

    [has_or_relation:protected] =>
    )

    [date_query] =>
    [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘vendors’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘acf-disabled’) ORDER BY wp_posts.post_date DESC LIMIT 0, 15
    [posts] => Array
    (
    [0] => WP_Post Object
    (
    [ID] => 20650
    [post_author] => 113
    [post_date] => 2020-04-07 16:12:39
    [post_date_gmt] => 2020-04-07 16:12:39
    [post_content] => Crown + Conquer is a fully independent agency driven by the belief that fostering personal and honest relationships and developing those relationships in an effort to help brands reach consumers through authentic partnerships is the most powerful, yet valuable weapon.
    [post_title] => Crown + Conquer
    [post_excerpt] =>
    [post_status] => publish
    [comment_status] => closed
    [ping_status] => closed
    [post_password] =>
    [post_name] => crown-conquer
    [to_ping] =>
    [pinged] =>
    [post_modified] => 2020-04-07 16:14:56
    [post_modified_gmt] => 2020-04-07 16:14:56
    [post_content_filtered] =>
    [post_parent] => 0
    [guid] => https://onesandbox.com/?post_type=vendors&p=20650
    [menu_order] => 0
    [post_type] => vendors
    [post_mime_type] =>
    [comment_count] => 0
    [filter] => raw
    [lat] =>
    [lon] =>
    [name] => Crown + Conquer
    [numLikes] => 0
    )

    Then show first 15 posts

    Thread Starter sguha007

    (@sguha007)

    Hello,

    get_posts() return first 15 posts because pagination are there. But not coming all 380 posts.

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Have you tried what happens without this function?

    — Yes. If I remove this function and do search without search term nothing is coming.

    Relevanssi does have the empty search term functionality built in

    — Can you please share the “the empty search term functionality” built in function

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Yes I see this. But here only one rate fetch that is FedEx Ground. But I need all the rates and will show those rates in radio button.

    Can you please tell me why only one rate coming.

Viewing 15 replies - 1 through 15 (of 22 total)