Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Make "Used for variations" checkbox visible for other variable-ish product types. #35004

Closed
helgatheviking opened this issue Oct 8, 2022 · 6 comments · Fixed by #36943
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement.

Comments

@helgatheviking
Copy link
Contributor

helgatheviking commented Oct 8, 2022

Describe the solution you'd like

When creating a custom product type that extends the variable product type, Need a way to show the show_if_variable attribute checkbox . The classes cannot be altered in the html-product-attribute.php template:

https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-attribute.php#L85-L87

But there's not a specific trigger for when the save attributes ajax function completes.

Describe alternatives you've considered

Looks like you can listen for $( '#variable_product_options' ).on( 'reload', function() {} ); but that's not initially obvious.

Additional context

No response

@helgatheviking helgatheviking added status: awaiting triage This is a newly created issue waiting for triage. type: enhancement The issue is a request for an enhancement. labels Oct 8, 2022
@roykho roykho added needs: developer feedback Issues that need feedback from one of the WooCommerce Core developers. plugin: woocommerce Issues related to the WooCommerce Core plugin. and removed status: awaiting triage This is a newly created issue waiting for triage. labels Oct 10, 2022
@github-actions
Copy link
Contributor

Hi @helgatheviking,

Thank you for opening the issue! It requires further feedback from the WooCommerce Core team.

We are adding the needs developer feedback label to this issue so that the Core team could take a look.

Please note it may take a few days for them to get to this issue. Thank you for your patience.

@barryhughes
Copy link
Member

Hi @helgatheviking,

But there's not a specific trigger for when the save attributes ajax function completes.

I think you were referencing a piece of code, but the link seems to be broken. Can you confirm, though, that existing event woocommerce_added_attribute isn't suitable for your needs here—what would you prefer to see if so?

@helgatheviking
Copy link
Contributor Author

helgatheviking commented Dec 16, 2022

@barryhughes Whoops... I think that link is in the metaboxes scripts, when the attributes are reloaded from the ajax response.

Unless it's possible to use this reload()

@barryhughes
Copy link
Member

Gotcha—thanks for clarifying, that makes perfect sense. I'm sure we can add a trigger at the bottom of that callback (and if you wish to submit a PR feel free to request my review—otherwise we will work our way towards this).

@barryhughes barryhughes added priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. and removed needs: developer feedback Issues that need feedback from one of the WooCommerce Core developers. labels Dec 16, 2022
helgatheviking added a commit to helgatheviking/woocommerce that referenced this issue Feb 23, 2023
@helgatheviking
Copy link
Contributor Author

helgatheviking commented Feb 23, 2023

@barryhughes there it is: #36943 Though I will say I Was able to do what I needed on

    $( '#variable_product_options' ).on(
        'reload',
        function() {
            console.debug("attributes saved");
        } 
    );
    ```
    
So I'm no longer blocked by this and it would be ok to close it as `wontfix`. i don't think it hurts anything though and 1 line of a new trigger won't have any backcompat issues.

@barryhughes
Copy link
Member

Agree, there is still utility and value in a dedicated event.

rodelgc added a commit that referenced this issue Feb 25, 2023
* Add an encoding selector to the product importer

* Add changelog file

* Don't assume the character encoding parameter is present

* Add woocommerce_attributes_saved trigger. Closes #35004.

* Fix create wc extension script (#36917)

* Run create-extension for create-wc-extension script

* Add changelog

---------

Co-authored-by: Sam Seay <samueljseay@gmail.com>

* Update product editor package (#36830)

* Add missing dev packages to product-editor package

* Create components folder for organization

* Move product field, section and tab slots over to product-editor package

* Move use of product slot fills to product-editor package

* Sync dependencies

* Add changelogs

* Update README's and add constant for default values

* Update README's in product-editor package

* Change SORT_STRING to SORT_NATURAL for the encodings list

Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>

* Add changelog

* Add custom rendering logic to the item label (#36476)

* Add type definitions

* Add custom rendering logic to the item label

* Add stories

* Add changelog file

* Fix rebase merge issue

* Fix up stories after rebase

---------

Co-authored-by: Matt Sherman <matt@jam123.com>

* Fix k6 incorrect step

* Fix k6 test env setup

---------

Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
Co-authored-by: helgatheviking <507025+helgatheviking@users.noreply.github.com>
Co-authored-by: louwie17 <lourensschep@gmail.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
Co-authored-by: Maikel David Pérez Gómez <mdperez86@gmail.com>
Co-authored-by: Matt Sherman <matt@jam123.com>
rodelgc added a commit that referenced this issue Feb 27, 2023
* Add an encoding selector to the product importer

* Add changelog file

* Don't assume the character encoding parameter is present

* Add woocommerce_attributes_saved trigger. Closes #35004.

* Fix create wc extension script (#36917)

* Run create-extension for create-wc-extension script

* Add changelog

---------

Co-authored-by: Sam Seay <samueljseay@gmail.com>

* Update product editor package (#36830)

* Add missing dev packages to product-editor package

* Create components folder for organization

* Move product field, section and tab slots over to product-editor package

* Move use of product slot fills to product-editor package

* Sync dependencies

* Add changelogs

* Update README's and add constant for default values

* Update README's in product-editor package

* Change SORT_STRING to SORT_NATURAL for the encodings list

Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>

* Add changelog

* Add custom rendering logic to the item label (#36476)

* Add type definitions

* Add custom rendering logic to the item label

* Add stories

* Add changelog file

* Fix rebase merge issue

* Fix up stories after rebase

---------

Co-authored-by: Matt Sherman <matt@jam123.com>

* Enable "Smoke test release" workflow (#36598)

* First pass at updating release test workflow

* Add changelog

* Set dir env variables

* Update to workflow

* Fix indent

* Fix indent

* Clean up indent

* Re-order steps

* Change order of jobs

* Added common php versions

* Update pipeline

* Update some labels

* Simplify for testing

* Update paths

* Create tmp folder

* Fix path

* Paths

* Try outputting some debugging

* Add step ID back

* Remove working directory

* Another path tweak

* Add API release tests

* Add k6 tests

* Add PHP tests

* Launch wp-env during PHP tests

* Try default values

* Tweak some settings, add WP testing

* Tweak some settings

* Re-order e2e steps

* Update step descriptions

* Reorganize tests, add plugin tests

* Enable only e2e job

* Initial set up to run against release smoke test site

* Fix syntax

* Temporarily disable update wc spec

* Temporarily disable downloading woocommerce zip

* Download release zip using tag name

* Fix wrong job name

* Fix wrong job name

* Fix dir

* Delete fetch-asset-id.js

* REfactor update-woocommerce spec

* Add error handling

* Download release zip by tag

* Refactor update woo spec to download zip by tag

* Correct job name

* fail test on invalid tag

* Enable all e2e tests

* Run api tests before e2e tests

* Fix job dependency

* Add customer credentials to api job

* Separate job for WC Update

* Combine e2e allure-results, then report

* Enable report job

* Fix context

* Change job and artifact names

* Use test s3 path

* Minor job name change

* Upload artifacts to bucket

* Correct s3 path

* Add quiet option

* Retain video on failures

* Finalize s3 path

* Try WP latest-1

* Revert to wp latest

* Refine search for woocommerce zip asset

* Get created-at

* Specify repo in gh command

* Slugify env description

* Trim space

* Sync with bucket instead of copy

* Remove invalid --recursive flag

* Re-add missing step to combine e2e results from update wc test

* Ensure artifact upload on test failure

* Enable all e2e tests on WP latest

* Retain existing data before updating WC

* Make test compatible with 'Canceled' and 'Cancelled'

* Set env_desc as env var

* Re-add deleted file

* Fix UPDATE_WC in daily smoke test workflow

* Add tracing in global setup

* Remove tracing

* Temporarily run only basic spec

* Job for WP Latest-1 & 2

* Fix "Required input 'created_at' not provided"

* Minor rename

* Remove install filter

* Install deps in get-wp-matrix

* Delete get-wp-versions.js

* Add get-wp-versions.js to e2e-pw folder

* REname file

* REfactor

* Refactor script for getting WP prev versions

* Update job dependencies

* Temporarily remove disabled jobs

* Allow e2e-wp-latest after api test failure

* Update L-1 & L-2 job deps

* Fix report-wp-latest

* Fix failing api test

* Make get-wp-versions quicker

* Publish report immediately after test

* Test reporting in e2e-update-wc

* Fix missing parameter

* Fix env_desc, re-enable other jobs

* Enable all e2e tests

* Minor job name change

* Fix flaky test

* Add php version testing

* stringify php versions

* Re-enable all e2e tests

* Up timeout to 2min

* Remove PHP 8.0

* Add missing conditionals

* Fix php version verification script

* Fix starting dir

* Fix flakiness

* Skip e2e if api failed

* Verify woocommerce.zip early

* Add token

* Delete test summary on github for the meantime

* Use default playwright config

* More meaningful variable names

* Update step titles based on review

* Use expect.poll()

* Minor spacing corrections

* Use `stable-check` endpoint, delete unnecessary loop

* Update locators to be JN-compatible

* Fix erroneous getting of release tag

* Fix conflict of "No thanks" button locator with that of WP Mail Logging's

* Update github-script action to v6

* Revert to 'Cancelled'

* Remove unnecessary step

* Provide missing env variables

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>

* Rename workflow file

---------

Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
Co-authored-by: helgatheviking <507025+helgatheviking@users.noreply.github.com>
Co-authored-by: louwie17 <lourensschep@gmail.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
Co-authored-by: Maikel David Pérez Gómez <mdperez86@gmail.com>
Co-authored-by: Matt Sherman <matt@jam123.com>
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants