0

My client's website will be selling jewelry. Mostly one of a kind rings. So once a ring is purchased, it's no longer available for sale.

The rings are available in a range of sizes. The size selected does not change the price of the ring. Most rings share the same set of available sizes, but some rings are available in additional sizes.

What's the easiest way I can set this up for my client?

I'd really like to avoid variable products as I believe this is primarily setup for product attributes that affect the price and possibly the appearance of the product. Variable products also require more steps to setup the new product.

I need to be able to choose (on a product by product basis) which values I want to populate a select list on the product page. The size that gets selected then needs to be viewable in the orders page or on the order email.

I'm fairly competent in php and javascript, so if there's some direction given I could possibly roll a custom solution. But perhaps there's a plugin or something that can achieve this?

1 Answer 1

1

You can use product attributes. You can configure them in the back-end, and then add something like this to your template:

<?php $sizes = $product->get_attribute( 'size' ); $sizes = explode(", ",$sizes); ?>
<?php if($sizes[0]!=''){ // if product sizes are available ?>
  <span class="product-size-label">Choose your size:</span>
  <select class="product-size">
  <?php foreach($sizes as $size){ ?>
    <option><?php echo $size; ?></option>
  <?php } ?>
  </select>
<?php } ?>

However, if it affects the price or appearance of your products, you have to use product variations. That's what they were designed for. As far as plugins go, I haven't tried any of them but it looks like there's a few that could achieve that fucntionality, e.g. this one.

2
  • 2
    Thanks so much for that. With your comment and the help of this tutorial: iconicwp.com/blog/add-custom-cart-item-data-woocommerce I was able to use single products and attributes to display the select list on the product page. The selected ring size is displayed on the checkout page, order, and email. I love it when things just work! Commented Sep 28, 2018 at 16:43
  • Thanks for the link too, I was just looking for a way to add extra parameters and add them to the shopping cart!
    – Pim
    Commented Oct 1, 2018 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.