{"id":23169506,"url":"https://github.com/khaledalam/wordpress-woocommerce-offer-plugin","last_synced_at":"2026-04-19T05:32:39.164Z","repository":{"id":171827876,"uuid":"648389782","full_name":"khaledalam/wordpress-woocommerce-offer-plugin","owner":"khaledalam","description":"Custom wordpress plugin to add woocommerce offers/gifts for specific products' categories.","archived":false,"fork":false,"pushed_at":"2023-06-08T09:44:48.000Z","size":28368,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T10:06:22.700Z","etag":null,"topics":["woocommerce","woocommerce-plugin","woocommerce-theme","wordpress","wordpress-development","wordpress-plugin","wordpress-theme"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khaledalam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-01T21:29:49.000Z","updated_at":"2024-04-30T15:56:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"64140e4e-40cd-4691-99dc-86f1ea7567d2","html_url":"https://github.com/khaledalam/wordpress-woocommerce-offer-plugin","commit_stats":null,"previous_names":["khaledalam/wordpress-woocommerce-offer-plugin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khaledalam/wordpress-woocommerce-offer-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fwordpress-woocommerce-offer-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fwordpress-woocommerce-offer-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fwordpress-woocommerce-offer-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fwordpress-woocommerce-offer-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khaledalam","download_url":"https://codeload.github.com/khaledalam/wordpress-woocommerce-offer-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fwordpress-woocommerce-offer-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271961854,"owners_count":24850593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["woocommerce","woocommerce-plugin","woocommerce-theme","wordpress","wordpress-development","wordpress-plugin","wordpress-theme"],"created_at":"2024-12-18T03:17:56.238Z","updated_at":"2025-10-30T00:06:11.097Z","avatar_url":"https://github.com/khaledalam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ANCHOVY ∪ NIU = { 9H }\n\n#### Custom wordpress plugin to add woocommerce offers/gifts for specific products' categories.\n\n[README Version 1](README_v1.md)\u003cbr /\u003e\nREADME Version 2 [current]\n\n### TODOs:\n- [ ] This is POC, some corner test cases not handled such as change offer product id, or eligible category id of the offer while there are some carts with old offer products..\n- [ ] Populate products in the select menu of offer product wc config and add validations for incorrect inputs\n- [ ] Validate preventing adding single offer product via [backend] e.g. curl or api call\n- [ ] Improve add\u0026remove item to cart logic (regarding update offers items)\n- [ ] Cover translations\n- [ ] Clean DB and remove any debugging or old unused wp options\n- [ ] Add Unit testing (e.g. PHPUnit)\n- [ ] Handle senario such as: delete offer -\u003e add eligable product to cart -\u003e restore offer -\u003e add another eligable product to cart (add/remove cart logic)\n\nV1 Demo video:\n\n\nhttps://github.com/khaledalam/wordpress-woocommerce-offer-plugin/assets/8682067/5f512a57-bc91-4191-9704-079c2753c0b6\n\n\n\n\n\nDB dump: [wordpress_v2.sql](./wordpress_v2.sql)\n\nTest cases: [test_cases](./test_cases)\n\n---\n\n### Problem/requirements\n- Ability to auto-add offer products(gifts) to wordpress woocommerce cart when user try to add any products from specific categories.\n- Ability to set the allowed categories \u003c-\u003e gifts from admin dashboard.\n- Restrict cart CRUD operations for this kind of \"offer\" products.\n\n---\n### Example\n\n- 3 t-shirt products =\u003e belongs to [Special Category] =\u003e add gift product(Clothes Hanger) for each item.\n- 2 short products =\u003e belongs to [Uncategorized] =\u003e add no gifts.\n\n\u003cimg src=\"./admin.png\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"./cart.png\"/\u003e\n\n----------------------------------------------------------------\n### Approach/solution/technical\n- Create custom woocommerce product settings section \"Offers Products\" that will allow the admin \u0026 shop manager to manage/set categories \u003c-\u003e gifts association in the dashboard.\n- Use filters/actions hooks:\n  - \u003cb\u003eActions\u003c/b\u003e:\n    - carbon_fields_register_fields\n    - after_setup_theme\n    - woocommerce_add_cart_item_data\n    - woocommerce_update_cart_action_cart_updated\n    - woocommerce_remove_cart_item\n    - wp\n  - \u003cb\u003eFilters\u003c/b\u003e:\n    - woocommerce_get_sections_products \n    - woocommerce_get_settings_products\n    - woocommerce_cart_item_remove_link\n    - woocommerce_cart_item_quantity\n- No hard-coded\n- \"Offer\" product marking depends set product id in  woocommerce product settings section \"Offers Products\"\n- Relation between product's category\u003c-\u003e\"offer\" product depends on wc options `product_offer_cat_term_id` and `product_offer_id`.\n\n---\n### Auth:\nadmin:\u003cbr\u003e\nuser: 9Huser\u003cbr\u003e\npass: 9Hpassword9H\u003cbr\u003e\u003cbr\u003e\nshop manager:\u003cbr\u003e\nuser: 9hshopmanager\u003cbr\u003e\npass: shopmanager9H\n\nPMA:\u003cbr\u003e\nuser: root\u003cbr\u003e\npass: password\u003cbr\u003e\n\n\n\u003e $ docker-compose up -d --build\n\n\n\n---\n#### References\n- [wordpress-docker-compose](https://github.com/kassambara/wordpress-docker-compose) used as template.\n- [wppb](https://wppb.me/) used as plugin template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhaledalam%2Fwordpress-woocommerce-offer-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhaledalam%2Fwordpress-woocommerce-offer-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhaledalam%2Fwordpress-woocommerce-offer-plugin/lists"}