Woocommerce:自定义类别的可用性 [英] Woocommerce: Customizing the availability of a category

查看:101
本文介绍了Woocommerce:自定义类别的可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WooCommerce的父类别中嵌套了许多产品。

我希望能够应用一个自定义字段,在其中可以将类别的时间可用性指定为仅在后端使用的管理功能。 / p>

理论:


  1. 后端-每个父类别,我将在此自定义字段中输入或选择 时间范围 :例如 11 :00-17:00

  2. 前端:


    • 在此 时间范围内 ,用户将能够浏览该类别中的所有产品。

    • 在此 时间范围 之外,该类别中的所有产品将保持可见(但无效),并且它们将显示为灰色或带有 'closed' 横幅(类似)


有人可以帮助我,甚至建议我从哪里开始?



提前谢谢。

解决方案

开始



您可以开始添加2个插件,在产品类别管理页面上添加自定义时间选择器






  • 然后您设置位置(这将是产品类别的分类术语):





    然后在选项中,您可以像在侧面(后端)上的Metabox一样选择它:





    添加新字段并命名后。您选择了字段类型和仅时间选项:




    [



    然后,您将编译所有其他选项以适合您的需求。然后,您可以保存并添加,如果需要第二个字段…



    现在,如果您转到 WooCommerce产品菜单,在类别子菜单下,将得到以下信息:





    现在您可以阅读一些 ACF文档 ,以及 wooThemes / woocommerce开发人员。文档



    您可以自定义 woocommerce覆盖模板 ,并使用。 .com / document / hooks / rel = nofollow noreferrer>>挂钩过滤器和操作



    您将在此处的StackOverFlow和Internet上找到许多代码,示例和教程,以开始并尝试实现您的项目。必要时,您将发布问题以寻求帮助,并使用所使用的代码告诉您什么在起作用,什么在不起作用……


    I have many products nested within parent categories in WooCommerce.
    I want to be able to apply a custom field where I can specify a time availability for categories as a admin feature only in Back end.

    Theory:

    1. Back end - On each parent category I will have this custom field where I can type or choose a time frame: for example 11:00-17:00.
    2. Front end:
      • During this time frame, users will be able to browse all the products within that category.
      • Outside of this time frame all the products within that category will stay visible (but inactive) and they will be displayed greyed out or with a 'closed' banner (something like that).

    Can anybody help me with this or even suggest me where I can start?

    Thanks in advance.

    解决方案

    THE BEGINING

    You can start adding 2 plugins to add a custom time picker on product categories admin pages:

    This is just he beginning (and I can't confirm that is the best way). So In ACF you create a group and you name it:

    Then you set the location (It's going to be a "taxonomy term" for "Product categories"):

    Then In options you can chose it like a Metabox on the side (on backend):

    After you add a new field and name it. You chose the field type and time only option:

    [

    Then now you are going to compile all the other options to fit your needs. Then you can save and add, if you need a 2nd field…

    Now if you go to the WooCommerce Products Menu, under categories submenu, you will get this:

    Now you can read a little the ACF documentation and also the wooThemes/woocommerce dev. documentation too.

    You can customize woocommerce overriding the templates and use hook filter and actions.

    You will find in here on StackOverFlow and over internet a lot of code, examples and tutorials, to begin and try to achieve your project. When needed you will post questions to get helped, with the code you are using telling what is working and what not…

    这篇关于Woocommerce:自定义类别的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆