Update package add to cart

This topic contains 9 replies, has 4 voices, and was last updated by  Patrik 5 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #481263

    Paige Kohalmi
    Expired Member
    Post count: 17

    Hi there,

    I have two packages free and premium. User can join to free package and update to premium later. I dont want the user to show the whole listing form when they update to premium.
    I use invoicing plugin to handle the cart and invoice.
    So, is there a function where I can pass the listingid(postid) and add the listing to cart and proceed to payment section?
    It would be great if you could just provide me the function which will add the details to the invoicing and proceed to checkout.
    Please let me know if you have any questions.
    Thank you,

    #481327

    Alex Rollin
    Moderator
    Post count: 27815

    That should happen automatically.
    When you configure packages, and save, the packages are synced to WP Invoicing items.
    When the user selects a package, they will be taken to checkout for the package automatically.

    #481505

    Paige Kohalmi
    Expired Member
    Post count: 17

    Hey Alex,
    Thank you for the reply. I am using my own custom page where I just show the package selection options only and not the whole listing form. I am trying to redirect the user to the cart/checkout page once the user selects the premium package. Is there a function where I can pass the post details and create invoice and redirect to checkout?

    #481542

    Alex Rollin
    Moderator
    Post count: 27815

    I will flag your question for the developers, but, please say more:
    Are you using WP Invoicing?
    Can you post the code you have so far?

    #481743

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    The easiest way to do it might be to add something to the link like &auto_checkout=1 and then with some JS make the form auto submit, this would be the safest way as there is lots of error checking going on and its all submitted via ajax.

    Stiofan

    #482187

    Paige Kohalmi
    Expired Member
    Post count: 17

    Hey guys thank you for your response. I am using WP Invoicing plugin for the payment processing. The code I am using is somewhat like this: (package id: 5 is the premium package)

    
    <?php 
    	if(isset($_POST['submit'])){
    		if($_POST['package'] == "5"){
                             $post = get_post($_POST['listingid']);
    			//proceed to wp invoicing adding to cart and forward to the payment gateway
    		}
    	}
    	//global $wpdb;
    	//$sql = $wpdb->get_results("Update {$wpdb->prefix}geodir_gd_coach_detail set package_id=5 WHERE ");
    ?>
    <form method="post" action="" name="updatePackage">
    	Please select a package
    	<br>
    	<br>
    	<input type="radio" name="package" value="1" checked> Free
    	<input type="radio" name="package" value="5"> Premium
    	<input type="hidden" name="listingid" value="<?php print $listingid?>">
    	<br>
    	<br>
    	<br>
    	<input type="submit" name="submit">
    </form>
    #482410

    Paige Kohalmi
    Expired Member
    Post count: 17

    Hey guys any update on this?

    #482463

    Paige Kohalmi
    Expired Member
    Post count: 17

    Hey guys,

    I found 2 functions in class-geodir-pricing-cart-invoicing.php file:
    1. ajax_post_saved
    2. create_invoice

    Not sure which function to use.
    I just want to redirect to the /wpi-checkout with the listing being added to cart and invoice. I would really appreciate your help on this. Please let me know if you have any questions.

    #482668

    Alex Rollin
    Moderator
    Post count: 27815

    Thanks for your post.

    We don’t actually provide customizations here in the forum, though we do try to advise when we can and time allowing.

    If you need time sensitive help for your customization from GD Experts you should contact a developer here.

    https://geodirectoryexperts.com/

    The developers will provide an update reply as soon as they are able.

    #482994

    Patrik
    Moderator
    Post count: 1971

    Hi,

    Can you look into this shortcode if it helps you to resolve your problem? https://wpinvoicing.com/docs/core-shortcodes/#wpinv_buy

    You need to pass the item ID from WPI and not the package ID from GD. Let me know if you have any queries.

    Regards,
    Patrik

Viewing 10 posts - 1 through 10 (of 10 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount