admin管理员组

文章数量:1301601

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?

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?

Share Improve this question edited Sep 28, 2018 at 3:45 Joseph Farruggio asked Sep 28, 2018 at 2:26 Joseph FarruggioJoseph Farruggio 131 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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.

本文标签: customizationWooCommerce Simple Product Options List