Jump to content
BZT

Removing the billing cycle from shopping cart

Recommended Posts

Hello.

I'm currently using a custom made price slider that points to set monthly product prices. A customer has the option to choose how much Ram they want for their service. I'm setting the prices and billing cycle for the Ram in the configurable options, and that's all fine and dandy, but the product monthly billing cycle is "interfering" with the general looks of the shopping cart.

I want the product it self to be set at $0.00, and i want the configurable Ram option to control the monthly billing cycle. However, if i do this, the "Choose Billing Cycle" is still showing (even tho it's st as $0.00). Is it possible to remove this from the shopping cart on all products and services, and let the configurable option controll the billing cycle?

Suggestions would be appreciated.

Thanks.

Choose Billing Cycle.png

Share this post


Link to post
Share on other sites

Using the ShoppingCartCheckoutOutput hook and injecting javascript to hide the menu and label should do the trick.   It needs to be hidden as if you remove it, WHMCS may error that there is no billing cycle selected. 

Share this post


Link to post
Share on other sites
12 minutes ago, steven99 said:

Using the ShoppingCartCheckoutOutput hook and injecting javascript to hide the menu and label should do the trick.   It needs to be hidden as if you remove it, WHMCS may error that there is no billing cycle selected. 

Want to get paid? 😅

I'm not a coder, and this would bring some huge challenges for me. If you don't mind helping me out with this, it would be appreciated. If not, i can gladly pay you for your services when it comes to achieve what i'm asking for, as long as you are including explinations on how (good to know for a rainy day - and if i have to repeat the process one day).

Thank you for your time.

Share this post


Link to post
Share on other sites

Not sure I can answer that without it being self promo.  😉  With that said, due to the web filter on the community, I can't post the hook as it doesn't like a bit of the code.  DM me your email and I will send it that way.  Mods, would not ask to contact but how else to give code if the web filter is going to block?   Perhaps one day I will do a github page or something. 😉

As a note for others, went with a the footer output hook instead as I wasn't thinking and the previous mentioned hook doesn't fire here -- and there isn't a hook for that page oddly and frustratingly.  Used an if to check the filename and the a (action) in _get for confproduct.  

Share this post


Link to post
Share on other sites
Posted (edited)
15 hours ago, steven99 said:

Not sure I can answer that without it being self promo.  😉  With that said, due to the web filter on the community, I can't post the hook as it doesn't like a bit of the code.  DM me your email and I will send it that way.  Mods, would not ask to contact but how else to give code if the web filter is going to block?   Perhaps one day I will do a github page or something. 😉

As a note for others, went with a the footer output hook instead as I wasn't thinking and the previous mentioned hook doesn't fire here -- and there isn't a hook for that page oddly and frustratingly.  Used an if to check the filename and the a (action) in _get for confproduct.  

If paying for a service through WHMCS isn't allowed, i just won't pay you. It's that simple. I don't want anyone to get in to any kind of problems due to a question/request like this. I thought that since there was a marketplace for WHMCS that there were some room for questions and requests like this.

I'm to new when it comes to WHMCS, so i really don't know the correct way of doing this through these forums, and if i'm in the wrong here, i would appreciate if a mod gave me some suggestions when it comes to requesting and receiving coes like this, and if it's allowed.

I've sent you my email address through DM, and thank you for aiding me with this issue.

Edited by BZT
edit

Share this post


Link to post
Share on other sites
15 hours ago, steven99 said:

Not sure I can answer that without it being self promo.  😉 

there's an element of self promo in any reply - even if it's subliminal! 😎

12 minutes ago, BZT said:

With that said, due to the web filter on the community, I can't post the hook as it doesn't like a bit of the code. 

were you getting a 403 Forbidden error? do you know what was the cause ??

i've just ran into it in a PM and it turns out that it didn't like $ _ GET (remove spaces) - never seen it do that before (in a code block or not)... ended up having to paste it into a pastebin and post the link instead.... farcical. 🙄

15 hours ago, steven99 said:

Used an if to check the filename and the a (action) in _get for confproduct.  

you couldn't use templatefile  and check for configureproduct?

18 minutes ago, BZT said:

If paying for a service through WHMCS isn't allowed, i just won't pay you. It's that simple. I don't want anyone to get in to any kind of problems due to a question/request like this. I thought that since there was a marketplace for WHMCS that there were some room for questions and requests like this.

technically, if you were going to pay originally, then it should be posted in Service Offers & Requests.

20 minutes ago, BZT said:

I'm to new when it comes to WHMCS, so i really don't know the correct way of doing this through these forums, and if i'm in the wrong here, i would appreciate if a mod gave me some suggestions when it comes to requesting and receiving coes like this, and if it's allowed.

the original question was fine, it was when you mentioned payment - that put Steven if an awkward position where you're damned either way... but to be honest, the mods won't care about this.... it would be slightly worse if it was reversed and Steven was the one asking for payment for a solution, but he didn't - nobody cares if you pay him or not... just don't make a song and dance about it publicly! 🙂

Share this post


Link to post
Share on other sites
10 minutes ago, brian! said:

technically, if you were going to pay originally, then it should be posted in Service Offers & Requests.

 

 Thank you for your valuable information. Like i said earlier, i don't use these forums much, and i'm to new here, so i just didn't know about this section at all since i thought the marketplace was the main arena for these kinds of things. Now i know.

Quote

the original question was fine, it was when you mentioned payment - that put Steven if an awkward position where you're damned either way... but to be honest, the mods won't care about this.... it would be slightly worse if it was reversed and Steven was the one asking for payment for a solution, but he didn't - nobody cares if you pay him or not... just don't make a song and dance about it publicly! 🙂

Thank you for clarifying. I'l go and put on some clothes and put out the boonfire i was planning to dance around this evening 😅

Share this post


Link to post
Share on other sites
13 minutes ago, BZT said:

Thank you for your valuable information. Like i said earlier, i don't use these forums much, and i'm to new here, so i just didn't know about this section at all since i thought the marketplace was the main arena for these kinds of things. Now i know.

unless you know that you want to pay for something, then posting questions in Developers Corner is fine....i'm sure if what you want to do is horrendously complicated (code for time-consuming to explain or write!), we'll tell you as much.

Share this post


Link to post
Share on other sites
1 hour ago, BZT said:

If paying for a service through WHMCS isn't allowed, i just won't pay you. It's that simple. I don't want anyone to get in to any kind of problems due to a question/request like this. I thought that since there was a marketplace for WHMCS that there were some room for questions and requests like this.

I'm to new when it comes to WHMCS, so i really don't know the correct way of doing this through these forums, and if i'm in the wrong here, i would appreciate if a mod gave me some suggestions when it comes to requesting and receiving coes like this, and if it's allowed.

I've sent you my email address through DM, and thank you for aiding me with this issue.

Just use the link Brian posted:

https://whmcs.community/community/137-service-offers-requests/

A some WHMCS Developer will be able to code this for you.

Share this post


Link to post
Share on other sites
1 hour ago, brian! said:

i've just ran into it in a PM and it turns out that it didn't like $ _ GET (remove spaces) - never seen it do that before (in a code block or not)... ended up having to paste it into a pastebin and post the link instead.... farcical. 🙄

you couldn't use templatefile  and check for configureproduct?,

yes, it was the _GET and likely _POST does the same .  Multiple ways to do it and was in a different mindset then whmcs methods at the time.  With that said, see below for a web filter safe hook.

<?php

/**
 * Hide the billing cycle on the cart's product configuration page.
 * Place within whmcs-install/includes/hooks
 *
 * @author steven99
 */
add_hook('ClientAreaFooterOutput', 1, function ($vars) {
    if (isset($vars['templatefile']) and $vars['templatefile']==='configureproduct')
    {
        $HTML = "<script> 
			$( document ).ready(function() {
                 $('#inputBillingcycle').parent().hide(); });
			</script>";
        return $HTML;
    }
});

 

Share this post


Link to post
Share on other sites
40 minutes ago, steven99 said:

<?php /** * Hide the billing cycle on the cart's product configuration page. * Place within whmcs-install/includes/hooks * * @author steven99 */ add_hook('ClientAreaFooterOutput', 1, function ($vars) { if (isset($vars['templatefile']) and $vars['templatefile']==='configureproduct') { $HTML = "<script> $( document ).ready(function() { $('#inputBillingcycle').parent().hide(); }); </script>"; return $HTML; } });

You're a beast! It works like a charm. You deserve gold, glory and eternal happiness 👍

Share this post


Link to post
Share on other sites

And a version that only applies to select products

<?php

/**
 * Hide the billing cycle on the cart's product configuration page.
 * 
 * Only hides for select products 
 *
 * Place within whmcs-install/includes/hooks
 *
 * @author steven99
 */
add_hook('ClientAreaFooterOutput', 1, function ($vars) {
    
    // Add the product ID to the array below with commas separting them.  For example: array(1,4,5)
    $Products = array();

    if (isset($vars['templatefile']) and $vars['templatefile']==='configureproduct')
    {
        if (isset($vars['productinfo'] ) and in_array($vars['productinfo']['pid'], $Products))
        {
            $HTML = "<script> 
			$( document ).ready(function() {
                 $('#inputBillingcycle').parent().hide(); });
			</script>";
            return $HTML;
        }
    }
});

 

Share this post


Link to post
Share on other sites
8 minutes ago, steven99 said:

});

Amazing, and such quick response as well. Thank you so much, this was really appreciated 🙏

Share this post


Link to post
Share on other sites
19 hours ago, steven99 said:

Multiple ways to do it and was in a different mindset then whmcs methods at the time. 

if the template used proper unique css classes/ids, then that would make life simpler.

Share this post


Link to post
Share on other sites
4 hours ago, brian! said:

if the template used proper unique css classes/ids, then that would make life simpler.

This.  1000000% agree.   I rarely see ids unless it is like inputs.  On a container?  nope.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated