icons and width

Hi,

Getting to grips with the theme but on this page https://webscontent.com/services/ the pricing plans doesn't seem wide enough and can't work out why it says get.. and how do I change that icon?

Thanks,

Richard

  • Nithin
    • Support Wizard

    Hi Richard,

    Could you please explain further whether you want to increase the width of the each pricing plan, or for whole table?

    So, that we could have a better idea about what exact CSS to share. Also, it seems like you are using WP Bakery, please grant support staff access so we could check whether it’s possible via the WP Bakery plugin too.

    You can grant access from WPMU DEV > Support > Support Access > Grant Access, or check this manual: https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-5

    Please let us know once you enable access, so that we could get this sorted. Have a nice day. :slight_smile:

    Kind Regards,

    Nithin

  • Richard
    • WPMU DEV Initiate

    Actually, having said that, I think it would look better if each pricing plan was wider too, so that they take up the space.

    Also when I choose a pricing plan https://webscontent.com/product/wc5000/ I would expect to see a button that adds that to the basket. I did look and saw a possible solution and added a plugin called Smippets: https://webscontent.com/2014/wp-admin/admin.php?page=snippets alas i don’t think I’m using it correctly since no changes happened.

    Thanks,

    Richard

  • Nithin
    • Support Wizard

    Hi Richard,

    Sorry for the delay in getting back to you, I gave a closer look via the WC Bakery editor to see whether there is any out of the box settings, but I’m afraid, don’t see anything helpful.

    You can apply this CSS, to make sure the tables have enough width:

    .themeva_pricing_table.animate {

    margin-left: -20%;
    display: inline-block;
    width: 130%;

    }

    You can add the above CSS code under the default WordPress customizer, under Appearance > Customize > Additional CSS.

    Also when I choose a pricing plan https://webscontent.com/product/wc5000/ I would expect to see a button that adds that to the basket. I did look and saw a possible solution and added a plugin called Smippets: https://webscontent.com/2014/wp-admin/admin.php?page=snippets alas i don’t think I’m using it correctly since no changes happened.

    You can add the following CSS to make the button that adds to the basket appear in product pages:

    #content > .product > div.row > div:nth-child(2) > div > form > button {
    background-color: black;
    }

    Regarding the code snippet shared, I’m not sure what exact workaround you are looking to achieve, however, the code seen in the Snippets should be adjusted to the product ID of your products, so the product ID in the code should be updated as following:

    $product_id = 7204; //replace with your own product id

    Where 7204 is the ID of WC5000, in short the final code would be as:

    /**
    * Automatically add product to cart on visit
    */
    add_action( 'template_redirect', 'add_product_to_cart' );
    function add_product_to_cart() {
    if ( ! is_admin() ) {
    $product_id = 7204; //replace with your own product id
    $found = false;
    //check if product already in cart
    if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
    foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
    $_product = $values['data'];
    if ( $_product->get_id() == $product_id )
    $found = true;
    }
    // if product not found, add it
    if ( ! $found )
    WC()->cart->add_to_cart( $product_id );
    } else {
    // if no products in cart, add it
    WC()->cart->add_to_cart( $product_id );
    }
    }
    }

    Which should work. Please do check, and let us know, if you have any further query. Have a nice day ahead. :slight_smile:

    Regards,

    Nithin

  • Richard
    • WPMU DEV Initiate

    Hi

    I think it works but I wonder if I can also make this function for the other products. e.g. 7204

    DO i need to add extra snippet for every product?

    When I try to add a CLone of the snippet and change the product ID to 7204 I get page that says:

    “Don’t Panic

    The code snippet you are trying to save produced a fatal error on line 24:

    Cannot redeclare add_product_to_cart() (previously declared in /home/webscont/public_html/2014/wp-content/plugins/code-snippets/php/snippet-ops.php(361) : eval()’d code:6)

    The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.

    Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.”

    Thanks,

    Richard

  • Ash
    • WordPress Hacker

    Hello Richard

    You can try this code:

    /**
    * Automatically add product to cart on visit
    */
    add_action( 'template_redirect', 'add_product_to_cart' );
    function add_product_to_cart() {
    if ( ! is_admin() ) {
    $product_ids = array( 1234, 2345, 3456, 4567 ); //replace with your own product ids
    $found = false;
    //check if product already in cart
    if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
    foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
    $_product = $values['data'];

    if (($key = array_search($_product->get_id(), $product_ids)) !== false) {
    unset($product_ids[$key]);
    }
    }
    }

    foreach( $product_ids as $product_id ) {
    WC()->cart->add_to_cart( $product_id );
    }
    }
    }

    So, in the following line you can set multiple IDs with comma separated:

    $product_ids = array( 1234, 2345, 3456, 4567 );

    Please note, the code is not tested. So if there is any error you get, please let us know the error as you did in your last reply :slight_smile:

    Have a nice day!

    Cheers,

    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.