fix: GAM product placements not saving when line_item_type absent #691
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a critical bug where placements weren't being saved when editing GAM products because the save logic was nested inside an
if line_item_type:check that never executed in automatic mode.Root Cause
The GAM product configuration save logic (lines 1147-1209 in
src/admin/blueprints/products.py) was inside anif line_item_type:conditional. Since the edit form uses automatic line item type selection (based on pricing model), the form doesn't submit aline_item_typefield. This caused the entire block to be skipped, preventing placements, ad units, targeting, and other GAM config from being saved.Changes
File:
src/admin/blueprints/products.pyline_item_typecheckif adapter_type == "google_ad_manager"insteadline_item_typeis explicitly providedFile:
templates/add_product_gam.htmltargeted_placement_ids(handles both string and array)Testing
Manual Testing Steps
Impact