Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7633727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:58:02+00:00 2026-05-31T06:58:02+00:00

I have the following code in place, however, I have to strip away all

  • 0

I have the following code in place, however, I have to strip away all the styling (any css) and have it return rather than echo, otherwise it messes up with some other code I’m using.
The other code I’m using echo’s a shortcode that outputs the following determined by if there is items in the cart or not.

Obviously I can’t echo (on the echo shortcode end of things), so I must return. If the cart is empty, it returns just fine as per my commented code below. It is when the cart has items, I can’t get it to return 🙁 my attempt is below.

//Original code, if there's items

if(is_object($cart) && $cart->countItems()) {
  ?>
  <div id="Cart66scCartContents" style="float:right; text-align: right;">
    <a id="Cart66scCartLink" href='<?php echo get_permalink($cartPage->ID) ?>'>
    <span id="Cart66scCartCount"><?php echo $cart->countItems(); ?></span>
    <span id="Cart66scCartCountText"><?php echo $cart->countItems() > 1 ? ' items' : ' item' ?></span> 
    <span id="Cart66scCartCountDash">&ndash;</span>
    <!-- <span id="Cart66scCartPrice"><?php //echo CART66_CURRENCY_SYMBOL . 
      number_format($cart->getSubTotal() - $cart->getDiscountAmount(), 2); ?> -->
    </span></a>
    <a id="Cart66scViewCart" href='<?php echo get_permalink($cartPage->ID) ?>'>View Cart</a>
    <span id="Cart66scLinkSeparator"> | </span>
    <a id="Cart66scCheckout" href='<?php echo get_permalink($checkoutPage->ID) ?>'>Check out</a>
  </div>
  <?php
}
else {

//My code, if there's no items (which works perfectly as a return)

    $emptyMessage = isset( $attrs['empty_msg'] ) ? $attrs['empty_msg'] : 'Your cart is empty';
    return "<p id=\"Cart66scEmptyMessage\" style=\"float:right; text-align: right;\">" . $emptyMessage . "</p>";

}

My attempt on setting the “if there’s items in the cart” to a return rather than echo..

if(is_object($cart) && $cart->countItems()) {      
  return "<a href='" . get_permalink($cartPage->ID) . "'>" . $cart->countItems(); . " " . $cart->countItems() > 1 ? ' items' : ' item' . "&ndash;" . number_format($cart->getSubTotal() - $cart->getDiscountAmount(), 2); . "</a> <a href='" . get_permalink($cartPage->ID) . "'>View Cart</a> | <a href='" . get_permalink($checkoutPage->ID) . "'>Check out</a>";
}
else {
    $emptyMessage = isset( $attrs['empty_msg'] ) ? $attrs['empty_msg'] : 'Your cart is empty';
    return "<p id=\"Cart66scEmptyMessage\" style=\"float:right; text-align: right;\">" . $emptyMessage . "</p>";

}

The text “1 item – View Cart | Check out” is not showing up with my attempt.
What have I done wrong?

Thank you!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:58:04+00:00Added an answer on May 31, 2026 at 6:58 am

    You have a semicolon at . $cart->countItems();, remove that and you should be good to go

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I'm finishing up an iPhone App. I have the following code in place
I have the following code in place, and it works: private void OnEvent(object sender,
I have the following code where I am handling an event twice. However I
I have the following javascript code in place which is used to give hover
I have the following code. //Create a view to place repeated arrow in. UIView
I currently have the following working code. It is painfully slow however. I know
I am working on a WordPress site and I have placed the following code
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.